Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Tom B. @ Wix

[Feature request] Are you panning on adding +=/-= values to CSS clip?

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

 

I'm playing with some "clip" animations right now, and find myself calculate way too many hardcoded values.

 

[Edit: this functionality exist, I still wish for the array option]

I think that an addition of relative values to clip:rect() will add a lot of flexibility.

 

Also, allowing clip to receive an array of values instead of the CSS syntax rect(a,b,c,d) could help ease development too.

 

something like so:

 // set initial clip:rect(0, 100px, 100px, 0) as required by CSS
TweenMax.set(element, {clip: [0, 100, 100, 0]})

// tween from clip:rect(50px, 80px, 100px, 0)
TweenMax.from(element, {clip: ['+=50', '-=20', '+=0', '+=0']})) 
Edited by Tom B.

Share this post


Link to post
Share on other sites

I'm in a bit of a rush at the moment so I haven't personally tried, but did you try using relative values that are not inside an array? Like:

TweenMax.from(element, {clip:'rect(+=50,-=20,+=0,+=0)'});

Just curious if you had any success. I vaguely remember that working.

  • Like 1

Share this post


Link to post
Share on other sites

oh! how stupid of me, it is working!

I couldn't find any reference to this in the documentation, so i didn't even try.

 

Still, I think that the second part of my request is still valid - everywhere in TweenMax, if you pass numbers without values TweenMax normalise them into 'px' values, but not in this case. 

Share this post


Link to post
Share on other sites

We like to pleasantly surprise our users with little gems like this ;)

Share this post


Link to post
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

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. 


  • Recently Browsing   0 members

    No registered users viewing this page.

×