Search In
• More options...
Find results that contain...
Find results in...

# Slowing down repeating animation until it reaches start.

## Recommended Posts

Posting this for future Google searchers:

To slow down a repeating animation in GSAP so it seems like it's losing momentum until it reaches the end position, animate both the 'timeScale' and 'progress' properties! Thanks to zadvorsky and zachsaucier for their help.

```var spin = TweenMax.to('#group',2,{
transformOrigin: 'center center',
rotation: 360,
ease: 'Linear.easeNone',
repeat: -1,
paused: true
});

var remaining = spin.timeScale() * ( spin.duration() - spin.time() ) * 3;

TweenMax.to(spin, remaining, {
timeScale: 0,
ease: 'Linear.easeNone',
onComplete: function(){ spin.pause(); }
},0);

TweenMax.to(spin, remaining, {
progress: 1,
ease: 'Power3.easeOut',
},0);

});
```

I haven't figured out a better way to calculate how long the slow-down animation should last. "spin.timeScale() * ( spin.duration() - spin.time() ) * 3" feels right for this animation, but three is a bit of a magic number. Any ideas on how to better calculate that?

See the Pen oLBqWz?editors=0010 by shshaw (@shshaw) on CodePen

##### Share on other sites

Thanks for the demo.

In addition to determining the duration the tricky part is finding an ease that will match the current velocity of the progress().

I think the best way to do this would be be to use ThrowProps as it will allow you to track() the velocity of the progress and then create a progress tween that tweens the progress() at the existing rate of change and will end at a progress(0).

See if this works better for you:

http://codepen.io/GreenSock/pen/ezvzEo?editors=0010

ThrowPropsPlugin is available to Club GreenSock members (Shockingly and above).

• 2