greensock / GSAP

GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
https://gsap.com
19.83k stars 1.72k forks source link

After 1.20.3 update animation of "clip" from right to left doesn't work anymore #242

Closed AmarBouchibane closed 6 years ago

AmarBouchibane commented 6 years ago

Take an element that's absolute positoned: .grey { position: absolute; left: 100px; width: 50px; height: 50px; top: 150px; clip: rect(0, 0, 50px, 0); } Now try to create an jalousie effect from left to right: TweenLite.to(".grey", 1, {clip: "rect(0, 50px, 50px, 0)", id:"grey"});

That's okay, but when you jalousie the element from right to left it doesn't work anymore (worked with 1.20.2): TweenLite.to(".grey", 1, {clip: "rect(0, 0, 50px, 0)", delay:3, id:"grey"});

jackdoyle commented 6 years ago

It looks like the problem is that you didn't specify a unit for the "0" values.

//BAD:
"rect(0, 0, 50px, 0)"

//GOOD:
"rect(0px, 0px, 50px, 0px)"

Does that help?

AmarBouchibane commented 6 years ago

A unit for a zero length is optional. You can read it in the CSS specification. https://www.w3.org/TR/css-values-3/#lengths So, it’s not BAD, but completely correct.

jackdoyle commented 6 years ago

Sorry, I didn't mean "bad" as if I'm shaming you for writing faulty code, nor was I talking about the official CSS spec. I was just saying that GSAP needs units if you want it to work properly in this case.

AmarBouchibane commented 6 years ago

Does it mean it won’t be fixed in a future release? Because this worked in 1.20.2.

jackdoyle commented 6 years ago

Well, I wouldn't really consider this a "bug" since I think it's reasonable to just define units, but as I'm working on the next big release, I'll look for ways to work this in. If it doesn't cost many kb, I'll do it. But I'm starting an entire rewrite for v2.0.0, so it might be a while :)

AmarBouchibane commented 6 years ago

My company has a business license so we'll can't update to 1.20.3 now. Otherwise, animations would behave differently with our customers. We should stay with version 1.20.2 now and see if it is fixed in 2.0?

jackdoyle commented 6 years ago

I didn't quite understand that question - are you saying that because you have a Business license, you can't update to 1.20.3? Why might that be? (Sorry, I probably misunderstood).

Also, are you saying that you cannot add px units to the "0" values? I apologize if I'm missing something obvious here. I read your note a few times and still find myself confused.

AmarBouchibane commented 6 years ago

Technically, we can update to 1.20.3. In fact, this has nothing to do with the licensing model. Sorry that I haven't spelled that out more clearly.

GSAP is integrated into one of our products to create animations in an eLearning tool. If we just updated GSAP to 1.20.3, some of the animations our clients create would not work anymore (like the Jalousie-Left animation, for example). So we would have to make adjustments to our software to transform a length from "0" to "0px" because of this change in GSAP 1.20.3. We could fix this problem with some effort, but that's just a change from the previous version 1.20.2, and I don't know what change might still be there.

jackdoyle commented 6 years ago

Ah, okay. Yes, I think the safest path forward would be for your system to define the units explicitly. I'll see if I can figure out a way to efficiently add the defaults in 2.0.0. Sorry about any confusion or hassle.