Jump to content
Search Community

Animating a glass filling with water

bcavenagh test
Moderator Tag

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 @bcavenagh :)

 

Welcome to the forum. 

 

You can target groups. I think scaleY is the effect you were looking for in your demo.

 

 

See the Pen YjRXRP by PointC (@PointC) on CodePen

But for a fill animation like that I think a clip-path or mask would yield a better animation. This is an answer to a different forum question, but shows the same concept.

 

See the Pen oLXjvr by PointC (@PointC) on CodePen

Hopefully that helps. Happy tweening.

:)

 

  • Like 5
Link to comment
Share on other sites

Could you help me create a clip path for the cup? I'm new to all of this and have no idea how to use clip-paths or masks. I'm trying to just replace the beer glass in the example with the glass svg from my image but it just gives me a spikey figure and the animation no longer does anything. How do I recreate that beer glass with my own stuff?

Link to comment
Share on other sites

Here's a quick clip-path version of your demo. I just eyeballed a polygon so it doesn't line up perfectly, but it should give you an idea how it works.

 

See the Pen EpOPwm by PointC (@PointC) on CodePen

Here are a couple good sources of info about masks and clip-paths.

https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Clipping_and_masking

https://css-tricks.com/masking-vs-clipping-use/

 

Happy tweening.

:)

 

  • Like 5
  • Thanks 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...