Get GSAP

Version: 1.13.1 updated 2014-07-22

Core

    Extras

      Plugins

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

        TweenLite

        TweenLite is an extremely fast, lightweight, and flexible animation tool that serves as the foundation of the GreenSock Animation Platform (GSAP). A TweenLite instance handles tweening one or more properties of any object (or array of objects) over time. TweenLite can be used on its own to accomplish most animation chores with minimal file size or it can be used in conjunction with advanced sequencing tools like TimelineLite or TimelineMax to make complex tasks much simpler.

        Basic Usage

        The most basic use of TweenLite would be to tween a numeric property of a generic JavaScript object.

        var demo = {score:0},
            scoreDisplay = document.getElementById("scoreDisplay");
        
        //create a tween that changes the value of the score property of the demo object from 0 to 100 over the course of 20 seconds.
        //each time the tween updates call the function showScore() which will handle displaying the value of demo.score.
        var tween = TweenLite.to(demo, 20, {score:100, onUpdate:showScore})
        
        function showScore() {
          scoreDisplay.innerHTML = demo.score.toFixed(2);
        }

        See the Pen TweenLite Tween Numeric Property by GreenSock (@GreenSock) on CodePen.

        note: Click on the "Result" tab to see the value of score animate.

        Animate CSS Properties

        For most HTML5 projects you will probably want to animate DOM elements. No problem. Once you load CSSPlugin TweenLite can easily animate CSS properties of DOM elements.

        /*external js
        http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenLite.min.js
        http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/plugins/CSSPlugin.min.js
        */
        
        window.onload = function() {
          var logo = document.getElementById("logo");
          TweenLite.to(logo, 2, {left:"542px", backgroundColor:"black", borderBottomColor:"#90e500", color:"white"});
        }
        

        See the Pen Animate Multiple Properties by GreenSock (@GreenSock) on CodePen.

        note: Click on the "Result" tab to see the animation.

        TweenLite isn't limited to animating DOM elements, in fact it isn't tied to any rendering layer. It works great with canvas and WebGL too!

        Control

        TweenLite is packed with methods that give you precise control over every tween. Play, pause, reverse, and adjust the timeScale (speed) whenever you need to. The demo below shows the power of just a handful of TweenLite's methods.

        See the Pen Control Playback by GreenSock (@GreenSock) on CodePen.

        note: Click on the "JS" tab to see detailed comments about what each button does.

        To see more of TweenLite in action visit our Jump Start guide and extensive CodePen collections.

        And so much more

        TweenLite is loaded with even more features allowing you to:

        • kill tweens
        • find active tweens
        • specify how overwriting of tweens should be handled
        • get/set the time, duration and progress of a tween
        • delay tweens
        • pass arguments into event callback functions
        • specify values to tween from

        The best place to get all the juicy details on what TweenLite can do is in the TweenLite documentation.

        Need even more tweening power? Be sure to check out TweenLite's beefy big brother TweenMax.