Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

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.

              const frame = new Frame("fit", 1024, 768, "#ff6337", darker);
frame.on("ready", function() {
	zog("ready from ZIM Frame"); // logs in console (F12 - choose console)

	let stage = frame.stage;
	let stageW = frame.width;
	let stageH = frame.height;

	// create a container for burger - easier to loop through and manage parts
	const burger = new Container(stageW, stageH).addTo();

	// DATA for burger parts 
	// will use ZIM Blob objects which can be Shape tweened
	// we will start with circles and rectangles and tween to the shapes below:
	// the data was made at in 2 minutes
	const top = [[-4,-49,0,0,-100,0,100,0],[100,11,0,0,1,-15,-1,15],[-2,13,0,0,100,0,-100,0],[-102,12,0,0,0,14,0,-14]];
	const mid = [[-4,-10,0,0,-100,0,100,0],[100,11,0,0,1,-15,-1,15],[-2,13,0,0,100,0,-100,0],[-102,12,0,0,0,14,0,-14]];
	const bot = [[-4,-10,0,0,-100,0,100,0],[100,11,0,0,1,-15,-1,15],[-4,55,0,0,100,0,-100,0],[-102,12,0,0,0,14,0,-14]];

	const colors = [brown, dark, yellow, dark, yellow, red, brown];
	const starts = ["circle", "circle", "rectangle", "circle", "rectangle", "circle", "circle"];
	const ends = [bot, mid, mid, mid, mid, mid, top];
	const pos1 = [[800,500], [750,270], [550,500], [500,600], [300,400], [250,350], [500,200]];
	const pos2 = [[500,400], [500,380], [500,360], [500,350], [500,330], [500,320], [500,300]];
	// create parts as Blobs - which can be shape tweened in ZIM (so can Squiggles)
	loop(colors, (color,i)=>{
		let part = new Blob({color:colors[i], borderColor:grey, points:starts[i], interactive:false})
			.loc(pos1[i][0], pos1[i][1], burger)
		// interactive of false turns off shape's cursor so part.cur() does not work
		// neither will burger.cur() - it usually would but not in this case
		// so put cursor with finger back on to shape

	// handle tomato core
	const tomato = burger.getChildAt(5);
	const core = new Container().addTo(tomato);
	loop(4, i=>{
		// to get a "fanning" effect
		// it is easiest to move registration and rotate
		new Triangle({color:white, borderColor:black})
			.reg(null, -15)

	// handle seeds
	const bun = burger.getChildAt(burger.numChildren-1);
	const seeds = new Container().addTo(bun);
	loop(60, i=>{
		// again, to locate randomly in a circle,
		// it is easiest to randomize the registration 
		// and the rotation
		new Circle(3, light, tin)
			.loc(seeds, null, seeds)

	const plate = new Circle(250, white, dark, 50)
	new Circle(110).alp(.2).center(plate).mov(0,-10);
	// ~~~~~~~~~~~~~~~~~~~~~~~~~~
	// note the series value from the ZIM VEE Pick object 
	// and the sequence parameter
		props:{x:series(stageW+200, -200)},

	// ~~~~~~~~~~~~~~~~~~~~~~~~~~

	let together = false;
	burger.tap(function () {
		together = !together; // toggle together each time
		if (together) {
			plate.animate({props:{alpha:.2}, time:300, wait:300});
			core.animate({props:{scaleY:0}, time:400, ease:"backIn"});
			seeds.animate({props:{scaleY:.3, y:"-25"}, time:400, ease:"backIn"});
						// shape tween to end Blob shape
						shape:new Blob({points:ends[i]}),
						x:pos2[i][0], y:pos2[i][1]
		} else {
			// planning on adding a reverseTween() method to avoid this 
			// alternatively, ZIM Tweens can be made dynamic and controlled 
			// see for example 
			// or any of the ZIM NIO examples:
			plate.animate({alpha:0}, 300);
			core.animate({props:{scaleY:1}, time:400, ease:"backOut"});
			seeds.animate({props:{scaleY:1, y:"25"}, time:400, ease:"backOut"});
						// shape tween to start Blob shape
						shape:new Blob({points:starts[i]}),
						x:pos1[i][0], y:pos1[i][1]
	new Label("Press to Create Burger!")
		.animate({props:{alpha:.7}, time:400, wait:1500});
	stage.update(); // this is needed to show any changes


	// make a greeting - come on in and join us on ZIM Slack!

	// call remote script to make ZIM Foundation for Creative Coding icon

}); // end of ready
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.