Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

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

CSS

              
                /* 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;
}
              
            
!

JS

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

Console