GreenSock Docs (HTML5/JS)

SlowMo

SlowMo is a configurable ease that produces a slow-motion effect that decelerates initially, then moves linearly for a certain portion of the ease (which you can choose) and then accelerates again at the end; it's great for effects like zooming text onto the screen, smoothly moving it long enough for people to read it, and then zooming it off the screen. Without SlowMo, animators would often try to get the same effect by sequencing 3 tweens, one with an easeOut, then another with a Linear.easeNone, and finally an easeIn but the problem was that the eases didn't smoothly transition into one another, so you'd see sudden shifts in velocity at the joints. SlowMo solves this problem and gives you complete control over how strong the eases are on each end and what portion of the movement in the middle is linear.

The first parameter, linearRatio, determines the proportion of the ease during which the rate of change will be linear (steady pace). This should be a number between 0 and 1. For example, 0.5 would be half, so the first 25% of the ease would be easing out (decelerating), then 50% would be linear, then the final 25% would be easing in (accelerating). If you choose 0.8, that would mean 80% of the ease would be linear, leaving 10% on each end to ease. The default is 0.7.

The second parameter, power, determines the strength of the ease at each end. If you define a value greater than 1, it will actually reverse the linear portion in the middle which can create interesting effects. The default is 0.7.

The third parameter, yoyoMode, provides an easy way to create companion tweens that sync with normal SlowMo tweens. For example, let's say you have a SlowMo tween that is zooming some text onto the screen and moving it linearly for a while and then zooming off, but you want to tween that alpha of the text at the beginning and end of the positional tween. Normally, you'd need to create 2 separate alpha tweens, 1 for the fade-in at the beginning and 1 for the fade-out at the end and you'd need to calculate their durations manually to ensure that they finish fading in by the time the linear motion begins and then they start fading out at the end right when the linear motion completes. But to make this whole process much easier, all you'd need to do is create a separate tween for the alpha and use the same duration but a SlowMo ease that has its yoyoMode parameter set to true.

//use the default SlowMo ease (linearRatio of 0.7 and power of 0.7)
TweenLite.to(myText, 5, {x:600, ease:SlowMo.ease});

//use a new SlowMo ease with 50% of the tween being linear (2.5 seconds) and a power of 0.8
TweenLite.to(myText, 5, {x:600, ease:new SlowMo(0.5, 0.8)});

//this gives the exact same effect as the line above, but uses a different syntax
TweenLite.to(myText, 5, {x:600, ease:SlowMo.ease.config(0.5, 0.8)});

//now let's create an opacity tween that syncs with the above positional tween, fading it in at the beginning and out at the end
TweenLite.from(myText, 5, {opacity:0, ease:SlowMo.ease.config(0.5, 0.8, true)});

Constructor

SlowMo( linearRatio:Number, power:Number, yoyoMode:Boolean ) ;

Constructor

Properties

ease : SlowMo

[static] The default ease instance which can be reused many times in various tweens in order to conserve memory and improve performance slightly compared to creating a new instance each time.

Methods

config( linearRatio:Number, power:Number, yoyoMode:Boolean ) : SlowMo

Permits customization of the ease with various parameters.

getRatio( p:Number ) : Number

[override] Translates the tween's progress ratio into the corresponding ease ratio.

Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.

Get GSAP

Version: 2.0.1 updated 2018-05-30

Core

    Extras

      Plugins

        By using GreenSock code, you agree to the terms of use.

        Help support GreenSock by becoming a member

        Join Club GreenSock