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

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 id="form-wrapper">
  <button id="reset">RESET ANIMATION</button>
  <button id="play">PLAY</button>
</div>
<div id="main">
  <svg id="stage" xmlns="http://www.w3.org/2000/svg" x="0" y="0" width="800" height="600" viewBox="0 0 800 600">
    <foreignobject class="node" x="0" y="0" width="100%" height="100%">
      
      <div id="type-container" width="100%" height="100%">
        
        <div class="wrapper" data-id="1">
          
          <div class="line" data-id="1">
            <span class="word" data-id="1">The </span>
            <span class="word" data-id="2">wind </span>
            <span class="word" data-id="3">blows</span>
          </div>
          
          <div class="line" data-id="2">
            <span class="word" data-id="1">where </span>
            <span class="word" data-id="2">it</span>
          </div>
          
          <div class="line" data-id="3">
            <span class="word" data-id="1">wishes</span>
          </div>
        </div>
        
        <div class="wrapper" data-id="2">
          
          <div class="line" data-id"1">
            <span class="word" data-id="1">and </span>
            <span class="word" data-id="2">you </span>
            <span class="word" data-id="3">hear</span>
          </div>
          
          <div class="line" data-id="2">
            <span class="word" data-id="1">its </span>
            <span class="word" data-id="2">sound</span>
          </div>
        </div>
      </div>
    </foreignobject>
  </svg>
</div>


              
            
!

CSS

              
                body
  margin: 0
  overflow: scroll
  font-family: 'alpha_echoregular', sans-serif
  background: #350000
@font-face
  font-family: 'alpha_echoregular'
  src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/81395/alpha_echo-webfont.eot')
  src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/81395/alpha_echo-webfont.eot?#iefix') format("embedded-opentype"), url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/81395/alpha_echo-webfont.woff') format("woff"), url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/81395/alpha_echo-webfont.ttf') format("truetype"), url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/81395/alpha_echo-webfont.svg#alpha_echoregular') format("svg")
  font-weight: normal
  font-style: normal

#main, #form-wrapper
  margin: 20px 0 0 20px
  padding: 0
  display: block
  position: relative

#main
  padding-right: 0
#form-wrapper
  padding-left: 0
  
#stage
  background: black url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/81395/grunge-paper-bg.jpg) no-repeat center center
  background-size: cover

#type-container
  width: 800px
  height: 600px
  display: flex
  flex-flow: row nowrap
  justify-content: flex-start
  align-items: flex-start
  font-size: 34px
  // color: #5d0707
  color: #000000
  font-family: 'alpha_echoregular', sans-serif
  // opacity: 0
  // position: relative
  // line-height: 1.0
  .wrapper
    display: flex
    flex-flow: column nowrap
    align-items: flex-start
  .line
    width: auto
    text-transform: uppercase
    // line-height: 1.0em
  .word
    display: inline-block
    line-height: 1.0em
    vertical-align: bottom
    // opacity: 0

#type-container > div 
  transform-origin: right center 0
  white-space: nowrap
  margin: 0

button 
  padding: 10px
  margin: 20px 0 
  background: green
  box-shadow: none
  color: white
  border: none
  padding: 6px 20px
  border-radius: 5px
  margin: 0 0 10px 0
  
              
            
!

JS

              
                var tl = new TimelineMax({paused: true}),
    stage = $('#stage'),
    typoContainer = document.getElementById('type-container');

function buildTweens() {

  var time = 0;

  $('.word').each(function(){
    var x = parseInt($(this).position().left),
        y = parseInt($(this).position().top),
        wd = parseInt($(this).width()),
        ht = parseInt($(this).height()),
        stageTween, wordTween;
    
    stageTween = TweenMax.to(stage,1,{
      attr:{ viewBox: `${x} ${y} ${wd} ${ht}` }
    });
    wordTween = TweenMax.to($(this),1,{opacity: 1});
    
    tl.add(stageTween,time);
    tl.add(wordTween,time);
    time += 1.5;
  });
}

$(function(){
  TweenMax.set($('.word'),{opacity: 0});
  buildTweens();
});

document.getElementById("reset").onclick = function() {
  TweenMax.set(stage,{attr:{viewBox: '0 0 800 600'}});
  tl.seek(0);
  tl.clear();
  buildTweens();
}

document.getElementById("play").onclick = function() {
  tl.play();
}

              
            
!
999px

Console