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

publishing responsive animate html/js question

Participant ,
Jan 01, 2020 Jan 01, 2020

Copy link to clipboard

Copied

when i publish my animation (1240x860) and check the box "make responsive" and "by width" and do not check "scale to fill visible area," i expect the animation to be a max width of 1240px but to fill any smaller screen horizontally like it works with an image but on small screens when the window isn't tall enough to fit the whole thing it makes the width smaller and margins appear, white space on both sides. with an image, it doesn't do that, it fills the width no matter what and cuts off some of the height and you can scroll to see the whole thing. i want my published animation to resize like an image does. i feel like i've tried every different way to publish it and nothing accomplishes that.  

TOPICS
Import and export , Publish package

Views

1.0K

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 , Jan 02, 2020 Jan 02, 2020

The scaling code is intentionally designed to keep the entire stage visible. To do what you want you'll have to modify the generated scaling code.

 

In makeResponsive(), change this line:

var iw = window.innerWidth, ih=window.innerHeight;

To this:

var iw = document.body.clientWidth, ih=window.innerHeight;

Then change this line (the second line):

else if(scaleType==1) {					
	sRatio = Math.min(xRatio, yRatio);

To this:

else if(scaleType==1) {					
	sRatio = xRatio;

 

Then publish as Make Responsi

...

Votes

Translate

Translate
LEGEND ,
Jan 02, 2020 Jan 02, 2020

Copy link to clipboard

Copied

The scaling code is intentionally designed to keep the entire stage visible. To do what you want you'll have to modify the generated scaling code.

 

In makeResponsive(), change this line:

var iw = window.innerWidth, ih=window.innerHeight;

To this:

var iw = document.body.clientWidth, ih=window.innerHeight;

Then change this line (the second line):

else if(scaleType==1) {					
	sRatio = Math.min(xRatio, yRatio);

To this:

else if(scaleType==1) {					
	sRatio = xRatio;

 

Then publish as Make Responsive by Width and check Scale to fill visible area.

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
Participant ,
Jan 02, 2020 Jan 02, 2020

Copy link to clipboard

Copied

thank you. when i do this it fills the width but i don't want it to be wider than 1240px;

i've experimented with max-width but can't get it to work.

 

 

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 ,
Jan 02, 2020 Jan 02, 2020

Copy link to clipboard

Copied

Yeah, because max-width is CSS. This is JavaScript. If you want to limit the max width you'll have to add that to the scaling 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
Participant ,
Jan 02, 2020 Jan 02, 2020

Copy link to clipboard

Copied

can you tell me how to do that? i tried adding 

style.maxWidth = "1240px";

to these:

canvas = document.getElementById("canvas");
anim_container = document.getElementById("animation_container");
dom_overlay_container = document.getElementById("dom_overlay_container");

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
Participant ,
Jan 02, 2020 Jan 02, 2020

Copy link to clipboard

Copied

now i have the canvas doing what i want but it is over the content that is meant to come below it and i can't figure out how to drop that content down below the canvas. 

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
Participant ,
Jan 02, 2020 Jan 02, 2020

Copy link to clipboard

Copied

LATEST

i got. 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