Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <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)" />
</svg>

</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>
              
            
!

CSS

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

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

JS

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

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

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

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

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

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

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

t3in();
currScene = "t3"

//need help here
  $('#buttons').click(function(){   
    
    var el = $(this).attr("id");
    
    currScene+'out()'; //play current scene out
    el+'in()'; //play selected timeline in
   
  })




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

  master.add(t1in())
        .add(t1out())
        .add(t2in())
        .add(t2out())
        .add(t3in())
        .add(t3out())
        .add(t4in())
        .add(t4out());


  $('#tM').click(function(){
        master.restart();
  })

              
            
!
999px

Console