• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Breaking content up into DIVs (to make responsive)

Contributor ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

Hi All,

I'm a new to Animate (and responsive web development) and I'm trying to understand how Animate CC would create a responsive site when exporting an HTML5 canvas final product.

It seems like the usual way to make a site 'responsive' is to use DIVs to break up the content so that individual elements can be rearranged and then CSS is used to control how each of those DIVs shows its content (on small screens). For example, here is a sketch of the way I'd like my site to behave when going from a desktop to a mobile screen: https://goo.gl/ybuXSf

Currently, when I export my site from Animate, the HTML wrapper puts all the Animate content into one DIV...All the all elements stay together so everything srinks in size on mobile screens.

Can Animate CC use DIVs to 'package' a site's content so that it behaves responsively and elements can stack on smaller screens like the above link shows? Can someone point me to an Animate tutorial about that?

Thanks Much!

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Sep 20, 2017 Sep 20, 2017

Animate uses the term 'responsive' to mean that the canvas is resized and scaled to fill the available area. What you're describing is more like what people think is responsive, but used to be called liquid layout.

Here's an article that covers both things, and for createjs:

CreateJS and HTML5 Canvas: resize, fullscreen and liquid layouts — Fabio Biondi

It doesn't use DIVs, but works on images. You should be able to do the same with movieclips, textfields and buttons, but not graphics. It would ha

...

Votes

Translate

Translate
LEGEND ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

Animate uses the term 'responsive' to mean that the canvas is resized and scaled to fill the available area. What you're describing is more like what people think is responsive, but used to be called liquid layout.

Here's an article that covers both things, and for createjs:

CreateJS and HTML5 Canvas: resize, fullscreen and liquid layouts — Fabio Biondi

It doesn't use DIVs, but works on images. You should be able to do the same with movieclips, textfields and buttons, but not graphics. It would have to be something that could be given an instance name. Or something that was made from a new library symbol. Maybe that would even work for graphics.

Some of the example code is just to set up createjs, and you may not need those parts, Animate will do those when you publish. So mainly look at the window resize listeners and resize function. Here's one example line that makes the logo appear in the upper right corner, regardless of the canvas size:

  // Logo: top-right position (canvasWidth - image width - 10 px padding)

  logo.x = stage.canvas.width - logo.image.width - 120 - 10;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 21, 2017 Sep 21, 2017

Copy link to clipboard

Copied

Thanks, Colin.

Yes that 'liquid layout' approach is what I'm talking about. I thought most sites that need to work for both desktop and mobile would use that approach (rather than just shrink all the page content together) so that the user can see content bigger.

I'll work through that article by Biondi.

Sounds like you're saying that Animate, by default, just shrinks the entire canvas including all elements on it ...and that I need to make all elements into symbols then use CreateJS to position them relative to screen size.

(I'm wondering if I should even be using Animate to design the whole website. Maybe it's just best for the animated elements...that make up the whole site.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 21, 2017 Sep 21, 2017

Copy link to clipboard

Copied

Animate is well suited to fixed asset positions, though it can scale and crop in useful ways. Most of the AIR apps on mobile that work fine on wide iPhone 5, or narrow iPad, are getting by with just scaling and cropping. If you want the UI buttons to be physically the same size on all screens, but give bigger screens more content area, then you have to get into the math needed for liquid layout.

It should all be the same math whether it's symbols on a canvas or DIVs and CSS. With DIVs and CSS there may be more public code libraries that will help you, and you could even do the whole thing in Muse perhaps. But, if you're doing a lot of things that Animate is the right tools for, and you want some amount of liquidness (hey, that's a real word!), I would look into doing the math with Animate symbols rather than either mix and match with DIVs, or switch to another tool that won't be as good for the majority of the work.

Having said that, I haven't had to do the math I'm talking about! So maybe it'll be harder than I'm thinking.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

I think I understand most of what you're saying:

Since my site will include lots of animation [When user clicks on some bitmaps they will zoom big (using tweens) and other bitmaps will move their internal parts (using timeline-based animation]...it sounds like I should continue to use Animate for the project.

I'll just need to design the whole site to reconfigure (changing the size and position of the elements) by using math and CreateJS so that it adapts to different screen sizes.

...and the method the Biondi article uses is an example of how that would work.

Thanks, Colin.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

The pure CreateJS way that Biondi and others use doesn't take advantage of things you can do in Animate. One approach you could take is to have variations of your UI laid out in the timeline, then jump to the best layout for the current device ratio, and scale it to make it fit the size of the screen. That's the approach Muse would take, you manually set boundaries at which the layout jumps to a different version, all without too much math.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

Interesting, Colin.

I'll look into that.

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

LATEST

Hi Paul, did you ever figure out how to make this work? I am working on a site with lots of moving parts, but can't figure out how to get them to adapt to screen size changes. Anything would help, thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

Animate is for games, cartoons, presentations, banners...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

And for anything else you want to do with it. Here's one app I did that had both kids game activities and also parent directed utilities:

Let’s Get Ready! on the App Store

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

Sorry, I am using Android

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines