I'm attempting to animate something traveling across the left side of screen to right side and repeating infinitely.
The only issue is, I'm setting the same animation speed but one animation is rendering faster than the other.
Two questions:
With the way I've set it up, how can I ensure consistent speed?
Is there a better way of setting up this animation? I feel it's a bit strange to split up the animations like I've done, but couldn't figure out a cleaner way.
thanks, I'm using React btw.
Extracting the GSAP stuff for those who want a quick look:
constructor(props) {
super(props);
this.tl = new TimelineLite({
onComplete: function() {
this.restart();
},
});
this.moped = null;
}
componentDidMount() {
this.tl
.from(this.moped, 2, {
delay: 2,
})
.from(this.moped, 2, {
x: '-400',
ease: 'Linear.easeNone',
})
.to(this.moped, 2, {
x: deviceWidth,
ease: 'Linear.easeNone',
});
}