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.


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.






                const frame = new Frame("fit", 1024, 768, purple, green);
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
	const stage = frame.stage;
	const stageW = frame.width;
	const stageH = frame.height;

	// see for an intro example
	// see for video and code tutorials
	// see for documentation
	// see for ZIM on CodePen
	// *** NOTE: ZIM Cat defaults to time in seconds
	// All previous versions, examples, videos, etc. have time in milliseconds
	// This can be set back with TIME = "milliseconds" but we suggest you give it a try!
	// There will be a warning in the conslole if your animation is not moving ;-)

	new Label("DAMPING", 50, "impact", green).pos(30,30);
	var circleGreen = new Circle(200, green)
		// by default drag() will bring the object to the top of its container
		// so use the onTop:false to prevent this from happening
		// property, baseAmount, minAmount, maxAmount, minTime, maxTime, totalTime
		.wiggle("x", stageW/2, 50, 100, .2, .4, 1.5)
		.wiggle("y", stageH/2, 50, 100, .2, .4, 1.5);	
	var circlePurple = new Circle(100, purple).center().noMouse();
	// damp will smoothen the motion as follow tries to follow the circle
	// we need to damp both the x and y properties for motion
	var dampX = new Damp(circleGreen.x);
	var dampY = new Damp(circleGreen.y);
	// damping requires constant updating so use a Ticker 
	// a Ticker is the fastest thing in which animation can happen 
	// for instance, you can't animate in a loop - but you can in a Ticker
	// it is based on the JS requestAnimationFrame()
	// but ZIM adds a queue so drag, animate, wiggle, etc. are also added 
	// so there is ever only one stage.update()
	// no matter how many functions are added to the Ticker
		// locate the inner circle at the damped value of the outer circle
		circlePurple.loc(dampX.convert(circleGreen.x), dampY.convert(circleGreen.y));

	stage.update(); // this is needed to show any changes


	// call remote script to make ZIM icon - you will not need this

}); // end of ready