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?

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.
Link to comment
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
Link to comment
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. 

Link to comment
Share on other sites

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

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.
×