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="stage-wrapper">
  <svg xmlns="http://www.w3.org/2000/svg" id="stage-master" version="1.2" width="800" height="400" x="0" y="0" viewBox="0 0 800 400">
  
    <foreignObject class="backgrounds" x="0" y="0" width="100%" height="100%">
    <div id="bg-1" class="bg-image" style="background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiCgkgdmlld0JveD0iMCAwIDgwMCA4MDAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDgwMCA4MDA7Ii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NS41LTU3LjMKCQkJQzQ4Ni4xLDg1LjUsNjA2LjYsNDMuNCw3OTkuOCw4MC40eiIvPgoJCTxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik03OTkuOCw2NjcuMXYxMzIuNmgtODAwVjU2MS4yYzQ3LjgtNi41LDE1OS4zLTEwLDI5NC40LDYyLjhDNDQ4LjksNzA3LjMsNjU5LjksNzM4LjUsNzk5LjgsNjY3LjF6Ii8+Cgk8L2c+CjwvZz4KPGcgaWQ9IkxheWVyXzRfMV8iPgoJPGcgaWQ9IkxheWVyXzJfMV8iPgoJCTxwYXRoIGNsYXNzPSJzdDMiIGQ9Ik03OTkuOC0wLjNWOTRjLTkzLTM0LjEtMjI4LjEtMzEuNC0zNjcuOCw2MC41Yy0xNDQuMyw5NS0zNDUuNCwxMjUuOS00MzIuMiw4NS4zVi0wLjNINzk5Ljh6Ii8+Cgk8L2c+CjwvZz4KPC9zdmc+Cg=='); width: 800px; height: 400px;"></div>
  </foreignObject>
    
  <foreignObject class="backgrounds" x="0" y="0" width="100%" height="100%">
    <div id="bg-2" class="bg-image" style="background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiCgkgdmlld0JveD0iMCAwIDgwMCA4MDAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDgwMCA4MDA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5c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: 800px; height: 400px;"></div>
  </foreignObject>

  <g id="text-group">
    <text dominant-baseline="hanging" font-size="200" width="800" height="400" stroke="black" fill="rgb(255, 255, 255)">
      <tspan alignment-baseline="hanging" y="120" x="150">TEST</tspan>
    </text>
  </g>
</svg>
</div>
<button id="play">Play</button>
              
            
!

CSS

              
                body
  margin: 0
  background: black
#stage-wrapper
  position: relative
  width: 800px
  height: 400px
#stage-master
  position: absolute
  margin: 0
  foreignObject.backgrounds
    div.bg-image
      width: 800px
      height: 400px
      background-size: cover
      background-repeat: no-repeat
      background-position: center center
    img
      max-width: 800px
g#text-group
  opacity: 1
  
              
            
!

JS

              
                var tl = new TimelineMax({paused: true});

TweenMax.set($('div[id="bg-1"]'),{opacity: 0});
tl.to($('div[id="bg-1"]'), 3,{opacity: 1},0)
  .to($('div[id="bg-2"]'), 3,{opacity: 0},0);

$('button#play').on("click", function(){
  tl.play(0);
});
              
            
!
999px

Console