Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="container">

<svg id="misvg"  viewBox="0 0 800 400">
<!-- Stgae left -->
<rect x="0" y="0" width="200" height="500" fill="#EEEEEE"/>
<text transform="translate(60 20)">Off stage</text>
<!-- s1 -->
<circle id="s1" cx="0" cy="0" r="50" fill="red" />
<!-- s2 -->
<rect id="s2" class="hb" x="0" y="50" width="100" height="100"/>
<!-- s3-->
<text id="s3" class="t32 ht" transform="translate(0 150)">TEXTO</text>
<!-- s3 -->
<path id="s4" d="M 100 100 L 300 100 L 200 300 z" fill="orange" transform="translate(-100 100) scale(.5)" />

</div><!-- </container> -->	
 <div id="buttons"><button id="t1">Play Circle</button> <button id="t2">Play Rect</button><button id="t3">Play Text</button> <button id="t4">Play Path</button><button id="tM">Play Master</button></div>


                #buttons {position:absolute;
top:0; right:40%; padding:1%}

.hb { fill: #afe1e3; }
.hw { fill: #ffffff; }
.t32 {font-size: 32px; font-family: Arial}


var animations = {
  t1in: function(){
    var ana1 = new TimelineMax({ });"#s1", 1, {attr:{cx:210, cy:110}, scale:2})
    //add more twwens
    return ana1;

  t1out: function(){
    var ana2 = new TimelineMax({ });"#s1",1, {attr:{cx:0, cy:0}, scale:1})
    //add more twwens
    return ana2;

  // ---scene 2 Square
  t2in: function(){
    var ana3 = new TimelineMax({ });"#s2", 1, {x:510, y:210})
    //add more twwens
    return ana3;
  t2out: function(){
    var ana4 = new TimelineMax({});"#s2", 1, {x:0, y:50})
    //add more twwens
    return ana4;

  // ---scene 3 Text
  t3in: function(){
    var ana5 = new TimelineMax({ });"#s3", 1, {x:510, y:210})
    //add more twwens
    return ana5;

  t3out: function(){
    var ana6 = new TimelineMax({ });"#s3", 1, {x:0, y:150})
    //add more twwens
    return ana6;

  // ---scene 4 Poly
  t4in: function(){
    var ana7 = new TimelineMax({ });"#s4", 1, {x:50, y:150})
    //add more twwens
    return ana7;

  t4out: function(){
    var ana8 = new TimelineMax({ });"#s4", 1, {x:-100, y:100, scale:0.5})
    //add more twwens
    return ana8;

currScene = "t3"

//need help here
$('#buttons button').click(function(){   
    var next = $(this).attr("id");
    if (next !== currScene && next !== "tM") {
      animations[currScene+'out'](); //play current scene out
      animations[next+'in'](); //play selected timeline in
      currScene = next;

var master = new TimelineMax({paused:true});

        .add(animations.t4out()).progress(1).progress(0); //force a recording of all the states immediately (start and end)