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.


                <div id="canvas-wrapper"></div>


                body {
  background: black;


                const trackData = "M2417.31,1378.41 l-6.25-5.92l-1.82-1.95v-1.22h-3.16c-0.79,0-3.7,3.16-3.7,3.16l-5.04,1.64c-1.26,0.41-1.92,2.42-1.92,2.42l-5.75,3.44h-4.59 l-2.54-1.58l-2.32-4.28v-3.58l-3.54-1.22l-5.52-1.04l-1.4-3.1v-4.97l-1.66-2.86l-4.61-0.95v-3.67c0-0.92-2.4-3.06-2.4-3.06 l-4.25-3.04l-0.8-2.83l-1.75-5.48h-4.79l-3.77-4.23l-1.12-2.86v-4.5l-3.05-5.71l-4.28-3.44l-2.82-4.84l-1.69-5.85l-0.52-0.06 l-4.09-3.21l-6.32-1.46l-7.75-3.4l-11.29-2.61l-2.16-2.89l-1.21-6.95l-3.22-4.92l-3.24-0.75l-7.79-3.75l-1.72-5.71l-1.08-4.7 l-7.45-5.9l-4.13-2.81l-6.18-1.43l-8.36-0.07c0,0-2.17-1.17-2-6.12"

const app = new PIXI.Application()
app.renderer = new PIXI.CanvasRenderer({
   width: window.innerWidth, 
   height: window.innerHeight,
   resolution: window.devicePixelRatio,
   transparent: true,
   autoResize: true,
   antialias: false
}) = 'pixi-canvas'
const mainContainer = new PIXI.Container()

//SVG world
app.loader.add('world', '')
app.loader.load((loader, resources) => {
  const world = new PIXI.Sprite(
  world.ratio = world.width/world.height
  //size the world
  //console.log("world", world.width, world.height, world.ratio)
  TweenMax.set(world, {
    width: app.view.width,
    height: app.view.width/world.ratio
  let xTransform = ((mainContainer.width*3) - app.view.width)*-0.5
  let yTransform = ((mainContainer.height*3) - app.view.height)*-0.5
  app.stage.setTransform(xTransform, yTransform, 3, 3)
  //add the pixi path
  const track = new PIXI.Graphics()
  let cubicBezier =  MorphSVGPlugin.pathDataToBezier(trackData, {})
  //calc the relative coords
  let newCubicBezier = []
  for (var i = 0; i < cubicBezier.length; i++) {
    let coords = this.getPathRelativeCoord(cubicBezier[i].x, cubicBezier[i].y)
    newCubicBezier[i] = []
    newCubicBezier[i].x = coords.x
    newCubicBezier[i].y = coords.y

  track.lineStyle(0.5, 0xFFFFFF)
  track.buttonMode = true            
  track.interactive = true
  /* track.hitArea = new PIXI.Rectangle(
  ) */
  track.on('click', (e) => { 
      //handle event
      console.log("total track clicked")
  // 1 - draw the path normally, this works
  //for (var i = 1; i < newCubicBezier.length; i++) {
  //  track.lineTo(newCubicBezier[i].x, newCubicBezier[i].y, 1)
  track.moveTo(newCubicBezier[0].x,newCubicBezier[0].y){ x: newCubicBezier[0].x, y: newCubicBezier[0].y }, 5, {
    bezier: { type: "soft", values: newCubicBezier },
    onUpdate: function(){
      track.lineStyle(0.5, 0xffffff);
      track.lineTo(,, 1);
    ease: Sine.easeOut

function getPathRelativeCoord(x, y) {
  let result = { x: 0, y: 0}
  result.x = (x * mainContainer.width)/4310.32
  result.y = (y * mainContainer.height)/2767.64
  return result