Plugin: GSAP

This plugin is meant to be used in conjunction with the Greensock Animation Plattform.
It offers an easy API to trigger Tweens or synchronize them to the scrollbar movement.

Both the lite and the max versions of the GSAP library are supported.
The most basic requirement is TweenLite.

To have access to this extension, please include plugins/animation.gsap.js.



Scene Constructor Extension

new ScrollMagic.Scene(options)

Every instance of ScrollMagic.Scene now accepts an additional option.
See ScrollMagic.Scene for a complete list of the standard options.

Name Type Argument Description
options object <optional>

Options for the Scene. The options can be updated at any time.

Name Type Argument Default Description
tweenChanges boolean <optional>

Tweens Animation to the progress target instead of setting it.
Does not affect animations where duration is 0.

var scene = new ScrollMagic.Scene({tweenChanges: true});

Scene Control Methods

Scene.removeTween(reset) → {Scene}

Remove the tween from the scene.
This will terminate the control of the Scene over the tween.

Using the reset option you can decide if the tween should remain in the current state or be rewound to set the target elements back to the state they were in before the tween was added to the scene.

Name Type Argument Default Description
reset boolean <optional>

If true the tween will be reset to its initial values.


Parent object for chaining.

{ Scene }
// remove the tween from the scene without resetting it

// remove the tween from the scene and reset it to initial position

Scene.setTween(TweenObject, duration, params) → {Scene}

Add a tween to the scene.
If you want to add multiple tweens, add them into a GSAP Timeline object and supply it instead (see example below).

If the scene has a duration, the tween's duration will be projected to the scroll distance of the scene, meaning its progress will be synced to scrollbar movement.
For a scene with a duration of 0, the tween will be triggered when scrolling forward past the scene's trigger position and reversed, when scrolling back.
To gain better understanding, check out the Simple Tweening example.

Instead of supplying a tween this method can also be used as a shorthand for (see example below).

Name Type Description
TweenObject object | string

A TweenMax, TweenLite, TimelineMax or TimelineLite object that should be animated in the scene. Can also be a Dom Element or Selector, when using direct tween definition (see examples).

duration number | object

A duration for the tween, or tween parameters. If an object containing parameters are supplied, a default duration of 1 will be used.

params object

The parameters for the tween


Parent object for chaining.

{ Scene }
// add a single tween directly
scene.setTween("obj"), 1, {x: 100});

// add a single tween via variable
var tween ="obj"), 1, {x: 100};

// add multiple tweens, wrapped in a timeline.
var timeline = new TimelineMax();
var tween1 = TweenMax.from("obj1", 1, {x: 100});
var tween2 ="obj2", 1, {y: 100});

// short hand to add a tween
scene.setTween("obj3", 0.5, {y: 100});

// short hand to add a tween for 1 second
// this is useful, when the scene has a duration and the tween duration isn't important anyway
scene.setTween("obj3", {y: 100});

Scene Parameters (getter / setter)

Scene.tweenChanges(newTweenChanges) → {boolean}

Get or Set the tweenChanges option value.
This only affects scenes with a duration. If tweenChanges is true, the progress update when scrolling will not be immediate, but instead the animation will smoothly animate to the target state.
For a better understanding, try enabling and disabling this option in the Scene Manipulation Example.

Name Type Argument Description
newTweenChanges boolean <optional>

The new tweenChanges setting of the scene.

  • Scene.change,event: when used as setter
  • get - Current tweenChanges option value.

    { boolean }
  • set - Parent object for chaining.

    { Scene }
// get the current tweenChanges option
var tweenChanges = scene.tweenChanges();

// set new tweenChanges option