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

Responsive object in Adobe Animate Canvas.

Explorer ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

I have an object that acts as a background image with nested animations that I'd like to be responsive to fit the total width of the viewport if the user resizes the browser window while keeping the width and height aspect ratio.

I presume this would be done with scaleX and scaleY but I'm not sure how to convert to pixel values and how to scale the width and height while keeping the aspect ratio. 

Views

416

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
Community Expert ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

click file>publish settings and select the options you want

 

kglad_0-1663853020352.png

 

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
Explorer ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

Thanks, but that scales everything on the stage. I should have mentioned that I'd like to scale only the background while preserving the dimensions of other objects on the stage. 

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
Community Expert ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

you want to scale the background and then unscale the children of the background?

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
Explorer ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

Effectively yes. The catch is the background is an object that has nested animations. I want that backgound image with nested animations to scale and fill the viewport. I have other objects on the stage that preserve their dimensions and are responsive in layout. That part I have sorted.

I guess I'm looking for a formular that converts scaleX, scaleY to pixel values so I can use it with something like window.innerWidth, window.innerWidth. For example, how do you determine scaleX to know the inner width of a browser and fill it. Not sure if that's a practical way of doing this though!

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
Community Expert ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

you don't need to convert.   just scale:

 

obj.scaleX = window.innerWidth/obj.nominalBounds.width

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
Explorer ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

That worked for perfectly for width, thanks! How do I now maintain the width and height aspect ratio?

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
Community Expert ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

function scaleObj(obj){

var w = obj.nominalBounds.width;

var h = obj.nominalBounds.height;

if(w/h>=window.innerWidth/window.innerHeight){

obj.scaleX = window.innerWidth/w;

obj.scaleY = window.innerWidth/w;

} else {

obj.scaleX = window.innerHeight/h;

obj.scaleY = window.innerHeight/h;

}

}

 

p.s. scaling the stage, you'll want to edit that code.

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
Explorer ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

Thanks so much! That almost works perfectly. The background object scales perfectly within the background dimensions, however stops scaling when exceeding the object dimensions.

I really appreciate your advice and help.

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
Community Expert ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

obj stops scaling when?

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
Explorer ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

Hopefully the screenshots give clarification.

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
Community Expert ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

is the stage size changing in screen1? (eg, in your publish settings you enabled scale to fit)

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
Explorer ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

The background stops scaling up in screen1 and the objects I have set to responsively sit on the right-hand side of the stage are clipped off. I presume the canvas or stage size has to be scaled as well? 

When I use 'scale to fit' in publish settings, it scales all objects on the stage (which I don't want) and messes with the responsive layout of the other objects as well. I just need the background only to scale to fit the entire browser window. 

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
Community Expert ,
Sep 23, 2022 Sep 23, 2022

Copy link to clipboard

Copied

i can't explain (actually, i still don't understand) what you're seeing without spending more than a few minutes working on this.  even 10 or 15 minutes, i don't mind expending without charge to help others via the adobe forums.

 

but if it looks likes it's going to require much more time, i ask to be paid.  perhaps someone else will be able to help you via the forums without charging anything.  (or, if you want to hire me to continue helping, send me a private message.)

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
Explorer ,
Sep 26, 2022 Sep 26, 2022

Copy link to clipboard

Copied

Hey, I totally understand. I really appraciate what you've helped out with so far, you've solved most of what I was trying to achieve. 

I'll start a new topic and be clearer as to what I'm trying to achieve. Hopefully someone can help out there. 

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
Community Expert ,
Sep 27, 2022 Sep 27, 2022

Copy link to clipboard

Copied

LATEST

you're welcome, and good luck!

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