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.






                // ZIM is a JavaScript Canvas Framework for coding creativity!
// - please visit to start a wonderful coding journey.
// The main site has banner sections of TEN excellent uses of ZIM.

// NOTE - we often make colorful things with shapes - that is our style
// ZIM can be used very well with images, etc. if that is your style
// sound is also no problem - but sometimes slows down CodePen's preview...

// ZIM provides many conveniences, components and controls 
// to help designers, developers and artists create interactive media 
// - why ZIM, features, applications
// - expand open any feature for info and examples

// Here are CodePen examples with comments for learning:
// - ZIM CodePen
// - ZIM Founder's CodePen

// There are also many tutorials, videos and references here:
// - ZIM Skool, ZIM Kids, ZIM Badges, etc.
// - ZIM Template, tools and more
// - join us on *** Slack *** for discussion and support

// -----------------

// ZIM is powered by CreateJS so we import CreateJS and ZIM in CodePen settings
// We make a Frame object which makes a stage on an HTML canvas 
// We then add objects to the stage and update the stage to see them 

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

	// ES6 Class that extends a ZIM Container 
	class Bee extends Container {
		constructor() {
			super(80,40); // must call superclass - CreateJS requirement
			let body = new Circle(30).siz(60,40).center(this); // this is the container
			new Tile(new Rectangle(5,60,yellow), 6, 1, 5, 0).center(body).setMask(body);
			body.cache(); // helps performance by turning vectors into bitmap
	// We have purple slants that need to match against the HTML outercolor
	// Relying on stage color can leave thin line artifact at edges during browser scaling
	// Try it if you want - comment this out and set color (first purple in Frame call) to pink
	new Rectangle(stageW, stageH, pink).addTo(); 
	// bees behind Grim
	const beesBack = new Container(stageW, stageH).rot(-5).sca(.8).alp(.6).centerReg();
	// points of Blob came from here
	const reaper = new Blob({
		// make Grim move around at SLOW speed
		.wiggle("x", stageW/2, 50, 100, 20000, 30000) // prop, start, min, max, minTime, maxTime
		.wiggle("y", stageH/2+100, 20, 50, 20000, 30000);	
	const mouth = new Circle(10, dark).sca(1,.7).rot(-10).loc(-8, -105, reaper);
	reaper.shape.cur(); // interactive false seems to keep cursor away so add to shape
	// bees in front of Grim
	const beesFront = new Container(stageW, stageH).rot(-5).centerReg();
	// move the bees along with the reaper
	// the two purple slants - fun!
	new Rectangle(stageW+500, 400, purple).reg(0,400).loc(0,0).rot(3);
	new Rectangle(stageW+500, 400, purple).loc(0,stageH).rot(-10);
	// make bees and wiggle them FAST!	
	// add some to front and some to back depending on ternary operation
	// condition?if true:if false
	// i%2==0?beesBack:beesFront
	loop(30, i=>{
		let x = rand(stageW*.4, stageW*.54); // tweaked until liked
		let y = rand(stageH*.2,stageH*.35);
		let bee = new Bee()
			.centerReg(i%2==0?beesBack:beesFront) // centerReg so goes in mouth properly
			.wiggle("x", x, 20, 400, 300, 500) // prop, start, min, max, minTime, maxTime
			.wiggle("y", y, 20, 150, 300, 500)
			.wiggle("rotation", 0, 10, 20, 1000, 2000);	
	// when clicked, animate bees into mouth
	reaper.on("click", ()=>{
	}, null, true); // just once
	function removeBees(bees) {
		bees.loop((bee, i)=>{
			// could use a series but need different location as time goes on
			timeout(i*100, ()=>{ 
				let locMouth = mouth.localToLocal(0,0, bees); // gets 0,0 of mouth in bees
					props:{x:locMouth.x, y:locMouth.y},
					call:()=>{bee.removeFrom()} // remove bee when animation is done
		}, true); // loop backwards anytime removing from container 
		// fill reaper with bee pattern ;-) 
		// this helps make a little story
		new Tile(new Rectangle(5,500,yellow), 40, 1, 5, 0)
			.ord(-1) // move under mouth in Blob
	new Label("GIVE GRIM A HEART!", 50, "impact", white).rot(-10).loc(425, 713).alp(.2);
	// we are animating so no need to update the stage
	// stage.update(); // this is needed to show any changes


	// call remote script to make ZIM Foundation for Creative Coding icon
	createGreet(null, 70);
	createCode(null, 130);

}); // end of ready