Fovi Posted April 16, 2017 Share Posted April 16, 2017 Hi, Is there any function for relative sprite height / width (%) ? I need sprite with 50% height of stage, now i keep tracking height of root stage and re-calculate height's. Is there better way to do it ? Like: stage{ position:relative; } sprite{ position:absolute; height:50%; width:100%; } Quote Link to comment Share on other sites More sharing options...
Taz Posted April 16, 2017 Share Posted April 16, 2017 I think the closest thing is stage scaling. That way no matter how many sprites you add, on resize you only have to set the stage's scale instead of each sprite's. Here's a little Code Pen that does this to keep the sprite sized at 100% by 50% of the stage dimensions (you have to open on CodePen to see it resize). Fovi 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.