Share Posted September 2, 2015 Hi there. This seems rather simple but actually might not be as a simple of a solution as I was hoping for. I'm trying to transform the height of a div: #mountain { position: absolute; top: 175px; left: 18px; width:123px; height:46px; background-image:url(mountain.png); } Using this GSAP TweenMax.from('#mountain', .5, {height:0, transformOrigin:"bottom"}); On <div id="mountain"></div> However it does transforms the height, it scales the div from the top down regardless of the transformOrigin setting. What am I missing? I suspect transformOrigin does not cover height? Can you suggest a workaround for what I'm trying to accomplish? Thanks. Link to comment Share on other sites More sharing options...
Share Posted September 3, 2015 Hi, The issue is that according to the box model spec, the height and width are considered from the top/left corner of the element. Also keep in mind that the transform origin property is for... you got it!! transforms and not size animations, such as width and height. The transform origin will take effect using scales. So you could scale your element in the Y axis from 0 using that transform origin string: TweenLite.from(element, 1, {scaleY:0, transformOrigin:"center bottom"}); Another option is the solution Shaun posted in this thread: http://greensock.com/forums/topic/12283-expand-div-from-bottom-to-top/ 3 Link to comment Share on other sites More sharing options...
Author Share Posted September 3, 2015 Hi thanks while the ScaleY isn't what I was looking for neither was Shaun's solution, however that Thread led me to this: See the Pen OVeeQa by ohem (@ohem) on CodePen And this: See the Pen KmLjr by GreenSock (@GreenSock) on CodePen which is what I was looking for. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now