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

Auto Save

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

              
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600">
  
  <defs>
        <filter x="-2.9%" y="-19.2%" width="105.9%" height="176.9%" filterUnits="objectBoundingBox" id="longLineShadow">
            <feOffset dx="0" dy="3" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
            <feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
            <feColorMatrix color-interpolation-filters="sRGB" values="0 0 0 0 0.168351581   0 0 0 0 0.345353522   0 0 0 0 0.265702649  0 0 0 0.502667856 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
        </filter>
        <filter x="-4.2%" y="-19.2%" width="108.3%" height="176.9%" filterUnits="objectBoundingBox" id="shortLineShadow">
            <feOffset dx="0" dy="3" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
            <feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
            <feColorMatrix color-interpolation-filters="sRGB" values="0 0 0 0 0.168351581   0 0 0 0 0.345353522   0 0 0 0 0.265702649  0 0 0 0.502667856 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
        </filter>
    <path id="para-short-line-start" d="M16.7242798,26 C16.7242798,22.4101491 19.6344289,19.5 23.2242798,19.5 C23.672447,19.5 28.1100207,19.5453568 28.5326607,19.6317306 C29.4639694,19.8220594 30.322766,20.2115514 31.0626149,20.7537708 C32.6764181,21.9364926 33.7242798,23.8458757 33.7242798,26 C33.7242798,28.2047738 32.6265625,30.153162 30.9478474,31.3284451 C30.164239,31.8770561 29.2540351,32.2572126 28.2697915,32.4163587 C27.9294177,32.471395 23.5801893,32.5 23.2242798,32.5 C19.6344289,32.5 16.7242798,29.5898509 16.7242798,26 Z"></path>
    <path id="para-long-line-start" d="M0.72427979,7.8065186 C-2.86557009,7.8065186 -5.77572021,4.8963694 -5.77572021,1.30651855 C-5.77572021,-2.28333232 -2.86557009,-5.19348145 0.72427979,-5.19348145 L4.72427979,-5.19348145 C8.31413066,-5.19348145 11.2242798,-2.28333232 11.2242798,1.30651855 C11.2242798,4.8963694 8.31413066,7.8065186 4.72427979,7.8065186 L0.72427979,7.8065186 Z"></path>
    <path id="para-short-line" d="M23.2242798,32.5 C19.6344289,32.5 16.7242798,29.5898509 16.7242798,26 C16.7242798,22.4101491 19.6344289,19.5 23.2242798,19.5 L118.22428,19.5 C121.814131,19.5 124.72428,22.4101491 124.72428,26 C124.72428,29.5898509 121.814131,32.5 118.22428,32.5 L23.2242798,32.5 Z"></path>
    <path id="para-long-line" d="M0.724279785,7.80651855 C-2.86557109,7.80651855 -5.77572021,4.89636943 -5.77572021,1.30651855 C-5.77572021,-2.28333232 -2.86557109,-5.19348145 0.724279785,-5.19348145 L140.72428,-5.19348145 C144.314131,-5.19348145 147.22428,-2.28333232 147.22428,1.30651855 C147.22428,4.89636943 144.314131,7.80651855 140.72428,7.80651855 L0.724279785,7.80651855 Z"></path>
  </defs>
  <rect x="50" y="50" width="300" height="200" fill="pink" />
  <circle id="greensock" cx="200" cy="150" r="50" fill="green" />
  <circle id="redsock" cx="200" cy="150" r="50" fill="red" />
  <circle id="bluesock" cx="200" cy="150" r="50" fill="blue" />
  <g id="para-lines" transform="translate(130.000000, 140.000000)">
    <g transform="translate(0.000000, 0.000000)">
      <g id="para2" fill-rule="nonzero">
        <use fill="black" fill-opacity="1" filter="url(#shortLineShadow)" xlink:href="#para-short-line"></use>
        <use fill="#452DB3" xlink:href="#para-short-line"></use>
      </g>
      <g id="para1" fill-rule="nonzero">
        <use fill="black" fill-opacity="1" filter="url(#longLineShadow)" xlink:href="#para-long-line"></use>
        <use fill="#452DB3" xlink:href="#para-long-line"></use>
      </g>
    </g>
  </g>
</svg>
              
            
!

CSS

              
                
              
            
!

JS

              
                gsap.config({ trialWarn: false });

const masterTimeline = gsap.timeline({ paused: true });

// circles
const circle = ["#greensock", "#redsock", "#bluesock"];
// hide them all untill needed
gsap.set(circle, { autoAlpha: 0 });

const textIn = createData(circle[0]);
const textOut = clearData(circle[0]);

const textIn2 = createData(circle[1]);
const textOut2 = clearData(circle[1]);

const textIn3 = createData(circle[2]);
const textOut3 = clearData(circle[2]);
////

masterTimeline
  .add(textIn)
  .add(textOut)
  .add(textIn2)
  .add(textOut2)
  .add(textIn3)
  .add(textOut3);

masterTimeline.play();

//// this will create our lines of text and circle intr
function createData(object) {
  // reset our objects so as not to show
  let reset = ["#para-long-line", "#para-short-line"];
  gsap.set(reset, { autoAlpha: 0 });

  // the starting points of each line
  gsap.set("#para-long-line", { morphSVG: "#para-long-line-start" });
  gsap.set("#para-short-line", { morphSVG: "#para-short-line-start" });

  const endLong =
    "M0.724279785,7.80651855 C-2.86557109,7.80651855 -5.77572021,4.89636943 -5.77572021,1.30651855 C-5.77572021,-2.28333232 -2.86557109,-5.19348145 0.724279785,-5.19348145 L140.72428,-5.19348145 C144.314131,-5.19348145 147.22428,-2.28333232 147.22428,1.30651855 C147.22428,4.89636943 144.314131,7.80651855 140.72428,7.80651855 L0.724279785,7.80651855 Z";
  const endShort =
    "M23.2242798,32.5 C19.6344289,32.5 16.7242798,29.5898509 16.7242798,26 C16.7242798,22.4101491 19.6344289,19.5 23.2242798,19.5 L118.22428,19.5 C121.814131,19.5 124.72428,22.4101491 124.72428,26 C124.72428,29.5898509 121.814131,32.5 118.22428,32.5 L23.2242798,32.5 Z";
  let tl = gsap.timeline();

  tl.fromTo(
    object,
    {
      transformOrigin: "50% 50%",
      y: "-=40"
    },
    {
      y: "+=40",
      autoAlpha: 1,
      ease: "back.out(1.4)",
      duration: 4
    },
    "edit"
  )
    .to(
      "#para-long-line",
      {
        autoAlpha: 1,
        duration: 0.3,
        ease: "power4.in"
      },
      "edit+=0.1"
    )
    .to(
      "#para-long-line",
      { morphSVG: endLong, duration: 1, ease: "power4.inOut" },
      "edit+=0.1"
    )
    .to(
      "#para-short-line",
      {
        autoAlpha: 1,
        duration: 0.3,
        ease: "power4.in"
      },
      "edit+=0.3"
    )
    .to(
      "#para-short-line",
      { morphSVG: endShort, duration: 1, ease: "power4.inOut" },
      "edit+=0.3"
    );

  return tl;
}

//// this will remove the assets
function clearData(object) {
  let tl = gsap.timeline();

  tl.to(object, { y: 90, duration: 1, autoAlpha: 0 })
    .to(
      "#para-long-line",
      {
        y: "+=20",
        duration: 0.8,
        ease: "power4.out",
        autoAlpha: 0
      },
      "start+=.1"
    )
    .to(
      "#para-short-line",
      {
        y: "+=20",
        duration: 0.8,
        ease: "power4.out",
        autoAlpha: 0
      },
      "start"
    );

  return tl;
}

              
            
!
999px

Console