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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              
            
          
!

CSS

            
              
            
          
!

JS

            
              const frame = new Frame("fit", 400, 300, darker, dark);
frame.on("ready", ()=>{ // ES6 Arrow Function - similar to function(){}
    zog("ready from ZIM Frame"); // logs in console (F12 - choose console)

    // often need below - so consider it part of the template
    let stage = frame.stage;
    let stageW = frame.width;
    let stageH = frame.height;

    // REFERENCES for ZIM at http://zimjs.com
    // see http://zimjs.com/learn.html for video and code tutorials
    // see http://zimjs.com/docs.html for documentation
    // see https://www.youtube.com/watch?v=pUjHFptXspM for INTRO to ZIM
    // see https://www.youtube.com/watch?v=v7OT0YrDWiY for INTRO to CODE

    // CODE HERE
	
	 // Thanks https://codepen.io/eliCrow/pen/MLdddR for the elegant drag on path formula 
	 // we have installed it in the new ZIM 10.3.0 and works better than what we had!
	 // It feels wrong to compare... but ZIM is 46% the size of the Paper version 
	 // ZIM itself will be bigger as it contains the dragging on path code
	 // but it is nicely abstracted so you don't have to think about it...
   
    const path = new Squiggle({
        color:"violet",
        thickness:2,
        interactive:false,
        points:`M0,129.5c22,0,40-31,40-41c0-8-3.2-13-10-13c-6,0-11,6-11,16c0,16,20,32,27,32c2,0,4-2,4-4s-1-5-4-5c-8,0-8,28-8,36c0,77,12,111,33,111c11.7,0,30-7.9,30-13c0-2.5-5-5-14-5c-7,0-11,1-11,5c0,8,22.4,16,32,16c49,0,126-66,126-108c0-5-1-12-8-12c-5,0-8,3.9-8,9c0,5.9,6,9,10,9c11,0,26-16,26-48c0-15-7-28-18-28c-28,0-17,37-74,37c-26,0-50,21-50,42c0,3,0,6,3,6s9-2,9-5s-8-3-15-3s-14,0-14,3s4,5,7,5s5-3,5-6c0-42-53-37-53-87c0-35,37-66,67-66c31,0,43,22,43,37c0,19-7,24.6-13.7,24.6c-6.2,0-10.6-5.3-10.6-10.6s4.4-10.6,10.3-10.6c11,0,17,12.2,17,23.6c0,15-17.6,28-17.6,28s-15.9-17-15.9-44c0-21,18.5-39,47.5-39c27,0,47,24,47,65c0,54-27,77-61,77c-26,0-39-14-39-14s12-16,27-16c13,0,21,12.9,21,17s-3.5,6-9,6s-9-2.7-9-6c0-6,11-17,23-17c18,0,32,12,32,35c0,38-45,69-76,69c-11,0-10-20-10-40c0-11,13-11,21-11s10,5,10,7c0,5-7,7-16,7c-6,0-38,0-43,0c-7,0-10-3-10-7s6-7,13-7c11,0,19,1,19,10c0,20,3,35-13,35c-29,0-62-29-62-80c0-20,18-49,49-49c25,0,38,18,38,18s-7,12-23,12c-12,0-22.3-11-22.3-18.5c0-5,5-5.6,9.7-5.6c4.7,0,8.9,0.6,8.9,6.2c0,5.6-9.3,17.3-21.3,17.3c-16,0-41-19.9-41-49.9c0-47.5,41-81.5,85-81.5c51,0,65,35.8,65,62s-11,51-43,51c-20,0-32-11-32-25s15.3-26.1,32.1-26.1`
    }).setBounds(260,270).center();

    // using percentComplete works on the current animation only
    // so if planning on doing more than one animation, 
	 // add the object to a container and animate the container and object separately
	
    const circle = new Container();
    const circleShape = new Circle(6, green).addTo(circle);
    circle.centerReg()
        .animate({
            props:{path:path},
		 		// setting drag pauses the animation 
		 		// but could circle.pauseAnimate(false) to drag while animating
            drag:true, 
            time:10000,
            ease:"linear", // important for dragging on path
            rewind:true, // rewind allows us to animate backwards at the end
            loop:true, // animation would end (no drag) once rewound if not a loop
            loopCall:()=>{
                circle.pauseAnimate(true);
                Ticker.add(ticker);
                circle.percentComplete = .01;
            }
        });
    circle.blendMode = "difference";

    const ticker = Ticker.add(()=>{
        if (circle.percentComplete > 49.9) { // half way through - due to rewind
            Ticker.remove(ticker);
            circleShape.animate([ // animation series in array
                {props:{scale:30}, time:1000, call:()=>{circle.pauseAnimate(false);}},
                {props:{scale:1}, time:3000}
            ]);
        }
    });
	
    stage.update(); // this is needed to show any changes
  
   // DOCS FOR ITEMS USED
	// https://zimjs.com/docs.html?item=Frame
	// https://zimjs.com/docs.html?item=Container
	// https://zimjs.com/docs.html?item=Circle
	// https://zimjs.com/docs.html?item=Squiggle
	// https://zimjs.com/docs.html?item=animate
	// https://zimjs.com/docs.html?item=pauseAnimate
	// https://zimjs.com/docs.html?item=addTo
	// https://zimjs.com/docs.html?item=centerReg
	// https://zimjs.com/docs.html?item=center
	// https://zimjs.com/docs.html?item=zog
	// https://zimjs.com/docs.html?item=Ticker 
 

}); // end of ready
            
          
!
999px

Console