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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <p>Be careful in the woods!!!</p>
<h1>Happy Hallow<span>tween</span>!</h1>
<div class="stage">
<svg id="demo" xmlns="http://www.w3.org/2000/svg" width="2000" height="1600" viewBox="0 0 1000 800">
<defs>
  <pattern id="slicePattern" patternUnits="userSpaceOnUse" width="1000" height="800" x="0" y="0">
    <text transform="translate(500 360)" text-anchor="middle" font-size="220" fill="#fff">SLICE IT!</text>
  </pattern>

  <pattern id="cutPattern" patternUnits="userSpaceOnUse" width="1000" height="800" x="0" y="0">
    <text transform="translate(500 500)" text-anchor="middle" font-size="90" fill="#fff">cut text into strips</text>
  </pattern>
</defs>

<g fill="url(#slicePattern)">
  <polygon id="slide1" points="0,150 551,150 201,400 0,400" />
  <polygon id="slide2" points="549,150 1000,400 999,400 1000,150" />
  <polygon points="200,400 550,150 1000,400" />
</g>

<g id="strips" fill="url(#cutPattern)">
  <rect x="0" y="420" width="1000" height="31" />
  <rect x="0" y="450" width="1000" height="21" />
  <rect x="0" y="470" width="1000" height="21" />
  <rect x="0" y="490" width="1000" height="51" />
</g>
  
<line x1="550" y1="150" x2="200" y2="400" stroke-width="1" stroke="white"/>
<line x1="550" y1="150" x2="1000" y2="400" stroke-width="1" stroke="white"/> 

  </svg>
</div>

<div id="details">Place your SVG text in a pattern element and you can slice it into as many pieces as you like without converting to compound paths.</div>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

body {
  padding: 0;
  margin: 0;
  font-family: "Roboto", sans-serif;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/314556/darkForest.jpg")
    center bottom no-repeat;
  background-size: cover;
}
.stage {
  display: flex;
  align-content: center;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100%;
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
}
#demo {

  max-height: 100%;
  max-width: 90%;
  font-weight: 700;
}

.gs-dev-tools {
  z-index: 10;
}

#details {
  width: 100%;
  max-width: 450px;
  position: absolute;
  bottom: 80px;
  left: 50%;
  text-align: center;
  font-size: 0.875em;
  color: white;
  z-index: 11;
}

h1,
p {
  margin: 0;
  padding: 0;
  text-align: center;
  position: relative;
  z-index: 10;
}
h1 {
  font-family: "Signika", sans-serif;
}

h1 span {
  color: #88ce02;
}

p {
  margin-top: 10px;
  font-weight: 700;
}

              
            
!

JS

              
                console.clear();
TweenMax.set("line", {drawSVG:0});
TweenMax.set("#details", {xPercent:-50});

var strips = document.querySelectorAll("#strips rect");
var tl = new TimelineMax({delay:0.75});

tl.staggerTo("line", 0.4, {drawSVG:true, ease:Power2.easeIn}, 0.25, "lineStart");
tl.staggerTo("line", 0.4, {drawSVG:"100% 100%", ease:Power2.easeOut}, 0.25, "lineStart+=0.25");
tl.to("#slide1", 1, {x:-13, y:9, ease:Circ.easeOut}, "lineStart+=0.25");
tl.to("#slide2", 1, {x:11, y:6.5, ease:Circ.easeOut}, "lineStart+=0.5");
tl.staggerFrom(strips, 1, {cycle:{x:[-2000, 2000]}, ease:Back.easeOut}, 0.15);
tl.staggerTo(strips, 0.4, {cycle:{x:[-50, 70, -70, 120], opacity:[0.5, 0.8]},  repeat:5, repeatDelay:0.2, yoyoEase:Elastic.easeOut.config(2, 0.2), ease:Back.easeInOut}, -0.05, "+=1");
tl.to("#cutPattern text", 1, {text:"slice it & dice it", ease:Linear.easeNone}, "+=0.5");
tl.staggerTo(strips, 0.5, {cycle:{y:[ -30, -10, 10, 30]}, repeat:3, repeatDelay:0.3, yoyo:true, ease:Circ.easeInOut}, 0, "+=1.5");
tl.to("#cutPattern text", 1, {text:"it's just SVG text", ease:Linear.easeNone}, "+=0.5");
tl.staggerTo(strips, 0.5, {cycle:{x:[-30, -160, 120, -50], y:[ -30, -10, 10, 30], rotation:[-2, 2, -4, 4]},  transformOrigin:"center center", repeat:3, repeatDelay:0.2, yoyo:true, ease:Back.easeInOut}, 0.07, "+=1");

GSDevTools.create();


              
            
!
999px

Console