css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <link href='//fonts.googleapis.com/css?family=Signika+Negative:300,400' rel='stylesheet' type='text/css'>

<div class="wrapper">
  <h1>Render Anywhere</h1>


  <p>The same exact GSAP syntax is driving the animations for DOM, SVG and WebGL Canvas. All animations are perfectly synchronized.</p>

  <!-- DOM -->
  <div class="demo" id="DOM">
    <h3>DOM</h3>
    <div class="stage">
      <div class="circle" id="DOMCircle"></div>
    </div>
  </div>

  <!-- SVG -->
  <div class="demo">
    <h3>SVG</h3>
    <div class="stage" id="SVG">
      <svg viewBox="0 0 200 300">
      
        <circle id="SVGCircle"
 cx="100" cy="-25" r="25" fill="red"/>
      </svg>

    </div>
  </div>

  <!-- WebGL canvas using Pixi.js -->
  <div class="demo">
    <h3>WebGL (Pixi)</h3>
    <div class="stage" id="PIXI">

    </div>
  </div>


</div>
<div class="brandBar">
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/GreenSock-logo-text-outlines.svg"></div>
            
          
!
            
              /* Global styles come from external css https://codepen.io/GreenSock/pen/JGaKdQ*/

.demo {
  width:200px;
  display:inline-block;
}


.stage {
  height:300px;
  background:black;
  position:relative;
  overflow:hidden;
}

.demo h3 {
  text-align:center;
  font-size:18px;
}

.circle {
  width:50px;
  height:50px;
  background:red;
  position:absolute;
  border-radius:50%;
  transform:translate(-50%, -50%);
  top:-25px;
  left:50%;  
}

p {
  width:600px;
}

.wrapper {
  width:610px;
}
h1 {
  font-size:30px;
}
            
          
!
            
              //From 7 Hidden Gems of GSAP (Net Magazine)
//Read full article: https://medium.com/net-magazine/7-hidden-gems-of-the-greensock-animation-platform-4fb71389f6ca#.t6xniz19i


function animation() {
  //The same exact GSAP syntax is driving the animations for DOM, SVG and WebGL Canvas (PIXI.js)
  TweenMax.to("#DOMCircle", 2, {y:275, repeat:-1, repeatDelay:0.5, ease:Bounce.easeOut});
  TweenMax.to("#SVGCircle", 2, {y:300, repeat:-1, repeatDelay:0.5, ease:Bounce.easeOut});
  TweenMax.to(PIXICircle, 2, {y:300, repeat:-1, repeatDelay:0.5, ease:Bounce.easeOut}); 
}













// Setup Pixi.js learn more http://goose.ninja/2015/08/29/pixi-js-tutorial-getting-started/

// Autodetect and create the renderer
var renderer = PIXI.autoDetectRenderer(250, 300, {antialias: true});

 // Append the renderer (<canvas> tag) to the DOM
document.getElementById("PIXI").appendChild(renderer.view);
 
// Create the main stage for your display objects
var stage = new PIXI.Container();

var PIXICircle = new PIXI.Graphics();
PIXICircle.lineStyle(0);
PIXICircle.beginFill(0xFF0000, 1);
PIXICircle.drawCircle(100, -25, 25);
PIXICircle.endFill();
stage.addChild(PIXICircle);


//perfectly synch PIXI renders with GSAP
TweenLite.ticker.addEventListener("tick", renderPIXI)
 
function renderPIXI() {
    renderer.render(stage);
}

animation();

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console