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

              
                <div id="container"></div>
	<a class="hidden" id="link" href="https://github.com/akzhy/Vara" target="_blank"></a>
              
            
!

CSS

              
                /*

This is a demo of the library Vara.js
https://github.com/akzhy/Vara
http://vara.akzhy.com

The content used here is a part from Harry Potter and the Chamber of Secrets, when Harry writes on Rom Riddle's diary.

*/
* {
  margin: 0;
  padding: 0;
}

#container {
  width: 80%;
  margin: 20px auto;
  min-height: 700px;
}
#container svg {
  min-height: 700px;
}
.hidden {
  width: 0;
  opacity: 0;
  overflow: hidden;
}

              
            
!

JS

              
                var fontSize = 72;
if(window.screen.width < 700) 
  fontSize = 32;
else if(window.screen.width < 1200)
  fontSize= 56;
var vara = new Vara(
  "#container", "https://cdn.jsdelivr.net/npm/vara@1.4.0/fonts/Satisfy/SatisfySL.json",
  [
    {
      text: "My name is Harry Potter",
      y: 150,
      fromCurrentPosition: { y: false },
      duration: 3000
    },
    {
      text: "hello Harry Potter, my name is Tom Riddle",
      y: 150,
      fromCurrentPosition: { y: false },
      delay: 3000,
      duration: 4000
    },
    {
      text: "Do you know anything about the Chamber of Secrets ?",
      y: 150,
      fromCurrentPosition: { y: false },
      delay: 3000,
      duration: 4500
    },
    {
      text: "Yes",
      y: 150,
      fromCurrentPosition: { y: false },
      delay: 3000,
      duration: 1000
    },
    {
      text: "Can you tell me ?",
      y: 150,
      fromCurrentPosition: { y: false },
      delay: 3000,
      duration: 4000
    },
    {
      text: "No",
      y: 150,
      fromCurrentPosition: { y: false },
      delay: 3000,
      duration: 1000
    },
    {
      text: "But I can show you",
      y: 150,
      fromCurrentPosition: { y: false },
      delay: 3000,
      duration: 4000
    },
    {
      text: "Let me take you back fifty years ago",
      y: 150,
      fromCurrentPosition: { y: false },
      delay: 3000,
      duration: 4000
    },
    {
      text: "Hi there,",
      y: 150,
      id: "no_erase",
      delay: 2000
    },
    {
      text:
        "This is Vara.js, a javascript library that can create realistic text drawing animations.",
      y: 50,
      x: 50,
      duration: 4000
    },
    {
      text: "Check out my Github page",
      color: "#421e82",
      id: "github"
    }
  ],
  {
    strokeWidth: 2,
    color: "#523c33",
    fontSize: fontSize,
    textAlign: "center"
  }
);
vara.ready(function() {
  var erase = true;
  vara.animationEnd(function(i, o) {
    if (i == "no_erase") erase = false;
    if (erase) {
      o.container.style.transition = "opacity 1s 1s";
      o.container.style.opacity = 0;
    }
  });
  vara.get("github").container.style.cursor = "pointer";
  vara.get("github").container.onclick = function() {
    document.querySelector("#link").click();
  };
});

              
            
!
999px

Console