Introduction

Introduction

TweenMaxarrow-up-right, and more. TweenMax was built for convenience, providing a single JavaScript file that contains everything you will commonly need for animating DOM elements.

Like TweenLite, a TweenMax instance handles tweening one or more properties of any object (or array of objects) over time. TweenMax can be used on its own or in conjunction with advanced sequencing tools like TimelineLite or TimelineMax to make complex tasks much simpler.

Examples

Resources

Subjects

Syntax

You can also define in CSS properties:

Methods

The most common type of tween is a TweenMax.to()arrow-up-right tween which allows you to define the destination values. Think in this way, your existing CSS styles is the starting point and be tweened to whatever you defined in TweenMax.

Other commonly used methods:

Use Timeline Tools to Create Chain Animation

There are two sequencing tools TimelineLitearrow-up-right and TimelineMaxarrow-up-right. TimelineMax extends TimelineLite, offering exactly the same functionality plus useful (but non-essential) features like repeat, repeatDelay, yoyo and more.

It is the ultimate sequencing tool that acts like a container for tweens and other timelines, making it simple to control them as a whole and precisely manage their timing.

Without TimelineMax, building complex sequences would be far more cumbersome because you'd need to use the delay special property for every tween which would make future edits far more tedious.

Example:

Use with jQuery

The selector engine (like jQuery) that should be used when a tween receives a string as its target, like

By default, TweenLite will look for window.$ and then window.jQuery and if neither is found, it will default to document.getElementById() (in which case it will also strip out any leading "#" in any IDs it receives). Feel free to use any selector you want: jQuery, Zepto, Sizzle, or your own.

Examples for using TweenMax with jQuery methods:

  • Hover Event

  • Click Event

Ease/ Curve

Greensock offers an intuitive Ease Visualizerarrow-up-right for us to fine-tune the animation. Ease is a very interesting parameter because it tells the TweenMax animation engine how to interpolate the change of the chosen value during the given time. There are lots of predefined functions to choose from.

If you don't define any easing in your tween, the default easearrow-up-right is Power1.easeOut.

Last updated