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


  <p>Below are 3 basic examples of GreenSock's exclusive eases</p>

  <div class="demos">
    <!-- DOM -->
    <div class="demo" style="width:170px;">
      <h3>SteppedEase</h3>
      <div class="stage" style="width:170px;">
        <div id="walker"></div>
        <div class="credits">Walker created by <a href="//codepen.io/eighthday/details/dYNJyR/">eigthdaydesign</a></div>
      </div>
      <div class="nav" style="text-align:left;">
    
    <input id="timeScaleSlider" type="range" min="0.2" max="3" value="0" step="0.2" style="width:80px;"/>
    <span id="timeScaleDisplay">tl.timeScale(1)</span>
  </div>
    </div>

    <div class="demo wide">
      <h3>SlowMo</h3>
      <div class="stage" id="SlowMoStage">
        
      </div>
      <div class="nav">
        <button id="restart">restart</button>
      </div>
    </div>


    <div class="demo">
      <h3>RoughEase</h3>
      <div class="stage" style="width:200px;">
        <img class="logo-man" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/logo-onboard-video.svg"  style="width:150px;"/>
      </div>
      <div class="nav" style="margin-left:-40px;">
        <button id="shake">shake</button>
        <button id="flicker">flicker</button>
      </div>
    </div>

  </div>
  <!-- close demos -->
</div>
<!-- close wrapper -->



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

h1 {
  font-size:30px;
}

h2 {
  font-size:20px;
}


.demos {
  width:100%;
  height:500px;

}

.demo {
  width:250px;
  height:500px;
  float:left;
  margin-right:5px;
}

.wide {
  width:200px;
}

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

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

#walker {
  /* top padding = (h / w) * 100 */
  /* (height & width of one frame) */
  padding-top:143.7%;
  display:block;
  background: url('http://eighthdaydesign.com/assets/img/walk.svg');
  background-size:cover;
}

.logo-man {
  width:200px;
  
  margin:auto;
  position:relative;
  display:block;
  top:20%;
}


#SlowMoStage div {
  display:inline-block;
  position:absolute;
  left:50%;
  top:50%;
  font-size:80px;
}

.nav {
  text-align:center;
}

.credits {
  position:absolute;
  left:10px;
  bottom:10px;
  font-family:sans-serif;  font-size:12px;
  
  
}

.credits a:link, .credits a:hover, .credits a:active, .credits a:visited {
  color:#ddd;
  text-decoration:none;
}
              
            
!

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


var shakeBtn = document.getElementById("shake"),
    flickerBtn = document.getElementById("flicker"),
    slowBtn = document.getElementById("slow"),
    fastBtn = document.getElementById("fast"),
    restartBtn = document.getElementById("restart"),
    timeScaleSlider = document.getElementById("timeScaleSlider"),
    slowMoAni = getSlowMoTimeline();
    

//create all animations

//SteppedEase

var walkAni = TweenMax.to('#walker', 1, {
    backgroundPosition: '100% 0px',
    ease: SteppedEase.config(22),
    repeat: -1
});

function update(){
  walkAni.timeScale(timeScaleSlider.value);
  timeScaleDisplay.innerHTML = "tl.timeScale(" + timeScaleSlider.value + ")";
}

timeScaleSlider.addEventListener("input", update);
timeScaleSlider.value = 1;

// Credits

// walker tutorial: http://eighthdaydesign.com/journal/sprite-animation
// walker original pen: https://codepen.io/eighthday/pen/dYNJyR


//SlowMo

function getSlowMoTimeline() {
  var phrase = "create dramatic text effects with SlowMo ease",
  words = phrase.split(" "),
  container = document.getElementById("SlowMoStage"),
  numWords = words.length,
  tl = new TimelineMax();

  for(var i = 0; i < numWords; i++){
    var word =  document.createElement("div");       // Create a <button> element
    var text = document.createTextNode(words[i]);     
    word.appendChild(text)// Create a text node
    container.appendChild(word); 
    TweenLite.set(word, {xPercent:-50, yPercent:-50})
    tl.from(word, 1, {scale:0, ease:SlowMo.ease}, "word" + i)
      .from(word, 1, {opacity:0, ease:SlowMo.ease.config(0.7, 0.7, true)}, "word" + i)
    
  }
  tl.timeScale(1.2)
  return tl;
}

restartBtn.onclick = function() {
  slowMoAni.restart();
}

//RoughEase

var shakeAni = new TimelineMax({paused:true});
shakeAni.from(".logo-man", 0.5, {x:2, y:2, ease: RoughEase.ease.config({ strength: 8, points: 50, taper: "none", randomize: true, clamp: false})})
.set(".logo-man", {x:0, y:0});

var flickerAni = new TimelineMax();
flickerAni.from(".logo-man", 0.5, {opacity:0, ease: RoughEase.ease.config({ strength: 8, points: 50, taper: "none", randomize: true, clamp: true})});

shakeBtn.onclick = function() {
  shakeAni.restart();
}

flickerBtn.onclick = function() {
  flickerAni.restart();
}



              
            
!
999px

Console