Hi all!
I'm working on finding the "best way" to approach animating the width of an object using the current implementation of GSAP TimelineMax paired with ScrollMagic:
https://gist.github.com/jodriscoll/bda71b0245776294779cc1f9573186cd
As most of you may know, animating the width of an element does not leverage the GPU, causing a reflow of the DOM, which is bad for performance, can break with bad JavaScript, reduces the 60hz/fps target, etc., etc. Unfortunately, I noticed the way the TimelineMax animates an object's property is through transform: matrix3d(). Which in turn, prevents the explicit usage/designation of transform: scaleX() to alter the width to/from through the TimelineMax().to properties.
A summarized snippet of where I'm managing this configuration can be seen below:
// ...
const ScrollLines = new TimelineMax()
.to( animate.down, 1, {
x: animate.neg,
y: animate.pos,
width: 0,
repeat: 1.25,
ease: Sine.easeOut,
yoyoEase: true
}, "together" )
.to( animate.up, 1, {
x: animate.pos,
y: animate.neg,
width: 0,
repeat: 1.25,
ease: Sine.easeOut,
yoyoEase: true
}, "together");
// ...
Actual question: Is there a way to alter the width of an element while still utilizing the core matrix3d calculation in TimelineMax?
You can see the current implementation of this animation on youcanwa.org, or view the demonstration here. Any suggestions or help would be much appreciated!