cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="demo">
  <div class="cell">
    <h2>SVG &lt;rect&gt;</h2>

    <svg version="1.1" id="svg" class="container" width="260" height="200"  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 260 200" xml:space="preserve">
        <rect id="svgRectangle" class="animated" x="20" y="60" width="220" height="80" fill="#91e600" />
    </svg>
  </div>
  <div class="cell">
    <h2>&lt;div&gt;</h2>
    <div class="container" style="width:260px; height:200px; position:relative;">
      <div id="divRectangle" class="animated"></div>
      
    </div>
  </div>
</div>
<div id="nav">
  <h3 id="message"></h3>

<div id="slider" style = "width:465px; float:left"></div>
 <button id="play" class="dark-grey-button club-demo-button">play</button>
</div>
            
          
!
            
              

body {
  background-color: #1d1d1d;
  color: #999;
  font-family: Arial, sans-serif;
  margin-left:18px;
}
strong {
  color: #DDD;
}
h2 {
  font-size:3em;
  line-height:1em;
  margin-bottom:0.1em;
  color: white;
  font-weight: 400;
  margin-top: 5px;
}
a, a:hover, a:visited {
  color:#71B200;
}
.container {
  border: 1px solid #666666;
  overflow: hidden;
  background:black;
}
.demo {
  display: table;
  font-family: monospace;
}
.cell {
  display: table-cell;
  padding-right: 18px;
  position: relative;
  text-align: center;
}
#divRectangle {
  position: absolute;
}
#divRectangle {
  background-color: #91e600;
  width: 220px;
  height: 80px;
  top: 60px;
  left: 18px;
}

button#play {
 float:right;
  margin-top:-8px;
  margin-right:10px;
}

#nav {
  width:560px;
  margin:0px auto;
  
}

.demo {
  width:560px;
  margin:0px auto;
}
            
          
!
            
              var elements = $("#svgRectangle, #divRectangle"),
    message = $("#message"),
    tl = new TimelineMax({onUpdate:updateSlider});

CSSPlugin.defaultSmoothOrigin = false;
//very basic TimelineLite code to animate elements and change the text.
//notice that both elements  (#divRectangle and #svgRectangle) both use the exact same tweens
tl.set(message, {text:'{rotation:360, transformOrigin:"50% 50%"}'})
  .to(elements, 1, {rotation:360, transformOrigin:"50% 50%"}, "+=1")
  .set(message, {text:'{rotation:"+=360", transformOrigin:"right bottom"}'}, "+=1")
  .to(elements, 1, {rotation:"+=360", transformOrigin:"right bottom"})
  .set(message, {text:'{scale:0, transformOrigin:"0px 0px"}'}, "+=1")
  .to(elements, 1, {scale:0, transformOrigin:"0px 0px"})
  .set(message, {text:'{scale:1, transformOrigin:"100% 0%"}'}, "+=1")
  .to(elements, 1, {scale:1, transformOrigin:"100% 0%"})
  .set(message, {text:'{scaleY:0, transformOrigin:"0% 50%"}'}, "+=1")
  .to(elements, 1, {scaleY:0, transformOrigin:"0% 50%"})
  .set(message, {text:'{scale:1, transformOrigin:"50% bottom"}'}, "+=1")
  .to(elements, 1, {scale:1, transformOrigin:"50% bottom"})
  .set(message, {text:'{scale:0.5, rotation:360, transformOrigin:"50% 50%"}'}, "+=1")
  .to(elements, 1, {scale:0.5, rotation:360, transformOrigin:"50% 50%"})




	$("#slider").slider({
            range: false,
            min: 0,
            max: 1,
			      step:0.001,
            slide: function ( event, ui ) {
                tl.progress( ui.value ).pause();
            }
     });	
			
	function updateSlider() {
		$("#slider").slider("value", tl.progress());
	}

$("#play").click(function(){
  if(tl.progress() === 1){
    tl.restart()
  } else {
    tl.play();
  }
})

tl.pause();


//be sure to test this in multiple browsers
            
          
!
999px
Loading ..................

Console