Pen Settings



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


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


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.


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, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: #111;



  This codepen is part of the svg.js
  advent calendar. You can find all
  the pens at twitter: @svg_js

const width = window.innerWidth
const height = window.innerHeight - 10

// Create SVG and set viewbox
// so that we zoom into the center
const canvas = SVG()
  .size(width, height)
  .viewbox(-width/8, -height/8, width/4, height/4)

// Big circle
      width: 1,
      color: SVG.Color.random()

// Hours line
const hour = canvas.line(0, 0, 0, -20)
  .animate(new SVG.Spring(400, 20))

// Minutes line
const min = canvas.line(0, 0, 0, -30)
  .animate(new SVG.Spring(400, 20))

// Seconds line
const sec = canvas.line(0, 0, 0, -38)
  .animate(new SVG.Spring(400, 20))

const update = () => {
  // Get time
  const d = new Date()
  let h = d.getHours()
  let m = d.getMinutes()
  let s = d.getSeconds()
  // Make sure we see partial hours
  h += m/60
  // Calculate angle
  const hAngle = h/24 * 360
  const mAngle = m/60 * 360
  const sAngle = s/60 * 360
  // Rotate
  hour.transform({rotate: hAngle, origin: [0, 0]})
  min.transform({rotate: mAngle, origin: [0, 0]})
  sec.transform({rotate: sAngle, origin: [0, 0]})

setInterval(update, 1000)