Jump to content
Search Community

Expand div from bottom to top?

Devotee007 test
Moderator Tag

Go to solution Solved by Shaun Gorneau,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi,

 

My first post here, I guess it's a real newbie one... I searched and couldn't find any post with this question, so I hope it's ok. What I try to do is to have a div expand from the bottom up, but I can only get it to expand from top to bottom. How can I reverse this?

 

//Devotee007

 

CSS:

.wrapper {
position:absolute;
top:40px;
left:40px;
width:430px;
height:0px;
z-index:1;
background-color:#000;
overflow:hidden; 
}
 
 
TweenMax.to(".wrapper", 1.2, {height:"430px", ease:Expo.easeOut});

 

Link to comment
Share on other sites

It sounds like you might want to animate a rectangular clipping path.  I had actually been wondering how to do the same thing recently, and found a helpful example in another thread.

 

I forked & updated it: 

See the Pen OVeeQa by ohem (@ohem) on CodePen

 

Masking/clipping custom shapes across browsers is kind of a nightmare, but clipping rectangles is well supported.  https://msdn.microsoft.com/en-us/library/ms530748(v=vs.85).aspx

 

Apparently clip rect is deprecated though...(?)

https://developer.mozilla.org/en-US/docs/Web/CSS/clip

 

But clip path seems to work too: 

See the Pen rVEEKL by ohem (@ohem) on CodePen

 

Any experts feel free to weigh in or correct me if there's anything wrong with my examples, I'm still new at this too.   :)

Link to comment
Share on other sites

  • 8 years later...

Hi @Alviere and welcome to the GSAP Forums!

 

Thanks for being a GSAP Club member and supporting GSAP!

 

I saw that you edited your original question. Can we assume that you found a solution for your issue?

 

Just in case Clip Path is supported by all major browsers and can be animated using GSAP as shown in these demos:

See the Pen zYbYjBo by GreenSock (@GreenSock) on CodePen

 

See the Pen YzBzXog by GreenSock (@GreenSock) on CodePen

 

Let us know if you have more questions.

Happy Tweening!

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...