Loading...

Test

Showcase

Check out these great websites to see SuperScrollorama in action

Scrollorama For Hire

Need help building your website? Contact us.

Fade It

Fly It

Spin It

Scale It

Smush It

Pin It

Slide It

Wipe It

Bounce It

Color It

Unpin It

Fling It

Move It

Parallax It

Parallax It

Parallax It

Bring It

How To Use

Please note, this is a powerful tool, and with great power comes great responsibility.
Use wisely. A little subtlety can go a long way.

★ ★ ★

SuperScrollorama is powered by TweenMax and the Greensock Tweening Engine. Go to greensock.com for documentation on how to use it. Why Greensock/TweenMax? Great performance, ease-of-use, expandibility and basically because it is awesome.

First, link to the jQuery CDN and then embed TweenMax.js and SuperScrollorama. Next, start up SuperScrollorama. Think of it as a controller for animation. You add tweens and timelines to it, targeting when an element appears in the viewport or at a specific scroll point.

When initializing SuperScrollorama there are several options you might want to change.

$.superscrollorama({options})

  • vars: optional properties for the pin method (object):
    • isVertical Are we scrolling vertically (true) or horizontally (false)? – default: true
    • triggerAtCenter: The animation triggers when the respective Element’s origin is in the center of the scrollarea (true). This can be changed here to be at the top/left edge (false) – default: true
    • playoutAnimations: When scrolling past the animation should they be played out (true) or just be jumped to the respective last frame (false)?
      (Does not affect animations where duration = 0) – default: true
    • reverse: Global flag do set if animations should be reversed (true) when scrolling back or not (false) – default: true

Example

	$(document).ready(function() {
		var controller = $.superscrollorama({
			triggerAtCenter: false,
			playoutAnimations: true
		});
	});

★ ★ ★

Use the addTween method to build your scroll animations.

.addTween(target, tween, duration, offset, reverse)

  • target: scroll position (number) or element (string or object)
  • tween: a Greensock animation tween object
  • duration: scroll duration of tween in pixels (0 means autoplay)
  • offset: adjust the animation start point
  • reverse: disable reverse animation on up scrolling (optional)

In the example below, the animation fades in when scrolled into view.

	controller.addTween('#fade', 
	    TweenMax.from($('#fade'), .5, {css:{opacity:0}}));

★ ★ ★

The default duration is 0, which means the tween plays through completely when its scroll point is reached. You can add a duration which will instead sync the tween progress to the scrollbar position. Instead of one tween, you can create a timeline of multiple tweens.
If you use the TweenMax or TimelineMax option {repeat: -1} the animation will loop indefinetly for the set duration.

	// parallax example
	controller.addTween(
	  '#examples-parallax',
	  (new TimelineLite())
	    .append([
	      TweenMax.fromTo($('#parallax-it-left'), 1, 
	        {css:{top: 200}, immediateRender:true}, 
	        {css:{top: -600}}),
	      TweenMax.fromTo($('#parallax-it-right'), 1, 
	        {css:{top: 500}, immediateRender:true}, 
	        {css:{top: -1250}})
	    ]),
	  1000 // scroll duration of tween
	);

★ ★ ★

The 4th parameter is offset, which you can use to adjust the scroll point at which the animation is triggered.

controller.addTween('#fade', 
  TweenMax.from($('#fade'),.5,{
    css:{opacity:0}}),
    0, // scroll duration of tween (0 means autoplay)
    200); // offset the start of the tween by 200 pixels

★ ★ ★

The 5th parameter is reverse, which you can use to disable reverse animation.

controller.addTween('#fade', 
  TweenMax.from($('#fade'),.5,{
    css:{opacity:0}}),
    200, 
    false); // prevent backwards animation of the element

★ ★ ★

Pass in a function to the tween for when the animation is complete.

controller.addTween('#fade', 
  TweenMax.from($('#fade'),.5,{
    css:{opacity:0}, 
    onComplete: function(){alert('test')}
  }));

★ ★ ★

You can remove any previously added Tweens using the removeTween method.

.removeTween(target, tween, reset)

  • target: scroll position (number) or element (string or object)
  • tween: a Greensock animation tween object; if not set, all Tweens for the target will be removed. (optional, default: null)
  • reset: if true the tween will be reset to the starting position. (optional, default: true)

In the example below, all tweens from the “#fade” element are removed and reset.

	controller.removeTween('#fade');

★ ★ ★

You can use the pin method to pin an element, do a series of animations and then unpin it.

The callback functions will be called with a boolean parameter, true if triggered at end (bottom) of pin, false, if triggered at the beginning (top point).

.pin(el, dur, vars)

  • el: element being pinned (string or object)
  • dur: scroll duration of pin (in pixels)
  • vars: optional properties for the pin method (object):
    • anim: tween animation object that occurs during the pin
    • offset: adjust the pin start point
    • onPin: callback function for start of pin
    • onUnpin: callback function for end of pin
    • pushFollowers: Decide if following elements should be pushed down (true) or scrolled past (false), default: true

Example:

	controller.pin($('#examples-2'), 3000, {
	  anim: (new TimelineLite())
	    .append(
	      TweenMax.fromTo($('#move-it'), .5, 
	        {css:{left: -200, top: 500}, immediateRender:true}, 
	        {css:{top: -400}})
	    )
	    .append(
	      TweenMax.to($('#move-it'), .5, 
	        {css:{left: 200}})
	    )
	    .append(
	      TweenMax.to($('#move-it'), .5, 
	        {css:{top: -200}})
	    )
	    .append(
	      TweenMax.to($('#move-it'), .5, 
	        {css:{left: 0}})
	    )
	});

★ ★ ★

You can use the updatePin method if you want to change options for pinned elements at runtime. For example when the window size or the size of your pin Item have changed. It Expects the same parameters as the .pin method, except all but the element is optional.

.updatePin(el, dur, vars)

  • el: element being pinned(string or object)
  • dur: scroll duration of pin (in pixels) (optional, default: 0)
  • vars: optional properties for the pin method (object):
    • anim: tween animation object that occurs during the pin
    • offset: adjust the pin start point
    • onPin: callback function for start of pin
    • onUnpin: callback function for end of pin
    • pushFollowers: Decide if following elements should be pushed down (true) or scrolled past (false), default: true

Example:

	controller.updatePin($('#examples-2'), null, {
		offset: 200
	});

★ ★ ★

You can remove any previously added Pins using the removePin method.

.removePin(el, reset)

  • el: element being pinned(string or object)
  • reset: if true the element will be unpinned and the tween will be reset to the starting position. (optional, default: true)

In the example below, the pin is removed, but not reset.
reset=false will also mean that if you call it during pin, the element will stay pinned.

	controller.removePin('#examples-2', false);

★ ★ ★

Sometimes you might want to tell SuperScrollorama to update all elements, for example when the window is resized. Here the method triggerCheckAnim comes in handy.

.triggerCheckAnim(immediately)

  • immediately: if true the update will be done immediately, if false it will wait for the next tickEvent of TweenMax (to save performance)
    (optional, default: false)

Example:

	$(window).resize(function () {
		controller.triggerCheckAnim();
	});

★ ★ ★

If you go the extra mile to make your SuperScrollorama application accessible to mobile users you’ll need the method setScrollContainerOffset. For more details see simpledemo_mobile.html

.setScrollContainerOffset(x, y)

  • x: the x offset of the scrollcontainer
  • y: the x offset of the scrollcontainer

Example:

	controller.setScrollContainerOffset(0, 200);

To top