Skip to main content
Inspiring
April 15, 2021
Answered

Animate cc html5 find original canvas height and width

  • April 15, 2021
  • 1 reply
  • 717 views

I'm looking for a way to get the canvas width and height after having opened the page and posibly resized the page.

 

My publish settings have to be on responsive but I need to get the widht and height my canvas was when it was drawn. If I after opening the page and resizing it simply get the width/height of the canvas by looking at it's current state this won't give me the initial values of width and height but it will return the current height and width.

 

I need to know the width and height it is when its not resized when it's currently resized to place an object on the mouse location after click and for this i need to calculate the ratio between the original size of the canvas and the current size. I can't add the width and the height of my drawing to my script because the width and height can be different and i would like to not have to edit the script each time.

This topic has been closed for replies.
Correct answer JoãoCésar17023019

Hi.

 

Use:

 

lib.properties.width;
lib.properties.height;

 

 

The essential document properties defined in the FLA are stored in this global var called lib that is created in the publishing process.

 

Regards,

JC

1 reply

JoãoCésar17023019
Community Expert
JoãoCésar17023019Community ExpertCorrect answer
Community Expert
April 15, 2021

Hi.

 

Use:

 

lib.properties.width;
lib.properties.height;

 

 

The essential document properties defined in the FLA are stored in this global var called lib that is created in the publishing process.

 

Regards,

JC