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.

            
              // A comparison file between ZIM and GSAP3
// original GSAP3 file - the beautiful:
// https://codepen.io/cassie-codes/pen/mdddaRG coded by Cassie Evans
// We compared the size at 3796 GSAP and 1860 ZIM.
// This is half the size for ZIM - we also compared the animate code at half the size 

// GSAP3 certainly has nice features and there are many 
// ZIM has many nice animation features too 
// and is integrated with a full canvas framework of interactivity!

const frame = new Frame("fit", 1024, 768, orange, 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

	// Created with ZIM Squiggle recordPoints();
	// or could bring in SVG
	// the SVG for the GSAP example was giving the parser issues so we are looking into it 
	// however we rebuilt the path in about ten minutes
	// see https://zimjs.com/nio/paths.html for examples
	var points = [[-196.1,114.5,-4.4,2.2,-18.3,2.4,9.5,2],[-145.5,105.4,0,0,-27.4,12.7,64,-29.6,"straight"],[-65.2,-139.4,0,0,78.9,0,-78.9,0],[-59.5,111.9,0,0,-40.5,0,40.5,0],[-9.4,43.4,0,0,0,0,0,0,"none"],[32.6,111.7,0,0,-53.9,0,53.9,0],[27.3,-7.7,0,0,74.8,-23.9,-48.3,15.5,"straight"],[120.6,48.9,0,0,-91,26.3,-4.3,40.6,"free"],[163.1,111,0,0,-35.1,3.2,61.6,-5.6,"straight"],[155.4,-6.7,0,0,74.6,-30.9,-51.4,21.3,"straight"],[252.5,38.5,0,0,-69.9,43,35.3,-21.7,"straight"],[280.7,-13,0,0,0,0,0,0,"none"],[262.3,233.9,0,0,42,0,-42,0],[316.1,-8.5,0,0,-37.5,22.3,60.1,-35.7,"straight"],[390,80.5,0,0,18.3,-48.2,-9.1,24.1],[320,113.8,0,0,19.7,12.9,-39.5,-25.8],[412.3,94.5,0,0,-70.7,-39,34.7,19.2,"straight"],[493.9,115.7,0,0,-26.6,0.4,26.6,-0.4]];

	var path = new Squiggle({
		points:points,
		thickness:20,
		color:yellow,
		interactive:false
	}).center().mov(0,-20);

	var dot = new Circle(9, purple)
		.addTo()
		.animate({
			props:{path:path},
			wait:1000,
			time:3500,
			ease:"quadOut",
			rewind:true,
			rewindWait:1000,
			rewindEase:"quadOut",
			loop:true,
			loopWait:1000
		});

	STYLE = {width:80, height:20, color:yellow, corner:10};
	new Rectangle().loc(93,462.5).bot();
	new Rectangle().loc(845,461).bot();

	// adjust style for next rectangles
	STYLE.width = 60;
	STYLE.color = blue;
	// both animations will be about the same
	var animObj = {
		props:{scaleX:.3},
		wait:500,
		time:300,
		rewindWait:100,
		rewind:true,
		rewindTime:100,
		loop:true,
		loopWait:8500
	};
	new Rectangle()
		.loc(93,462.5)
		.animate(animObj);
	// the second animation needs a larger wait time
	animObj.wait = 5000;
	new Rectangle()
		.loc(865,461)
		.reg(60,null,true)
		.animate(animObj);

	// Title
	STYLE = null; // turn off style 
	new Label("ZIM at half GSAP3 size")
		.alp(.5)
		.pos(40,40)
		.animate({
			props:{x:-400},
			from:true,
			wait:500,
			time:300,
			ease:"backOut"
		})

	// DOCS FOR ITEMS USED
	// http://zimjs.com/docs.html?item=frame
	// https://zimjs.com/docs.html?item=Frame
	// https://zimjs.com/docs.html?item=Circle
	// https://zimjs.com/docs.html?item=Rectangle
	// https://zimjs.com/docs.html?item=Squiggle
	// https://zimjs.com/docs.html?item=Label
	// https://zimjs.com/docs.html?item=animate
	// https://zimjs.com/docs.html?item=pos
	// https://zimjs.com/docs.html?item=loc
	// https://zimjs.com/docs.html?item=mov
	// https://zimjs.com/docs.html?item=bot
	// https://zimjs.com/docs.html?item=alp
	// https://zimjs.com/docs.html?item=reg
	// https://zimjs.com/docs.html?item=addTo
	// https://zimjs.com/docs.html?item=center
	// https://zimjs.com/docs.html?item=zog
	// https://zimjs.com/docs.html?item=STYLE

	// FOOTER
	// call remote script to make ZIM Foundation for Creative Coding icon
	createIcon(); 
	const greet = createGreet();
	greet.backgroundColor = green;
	greet.rollBackgroundColor = pink;
	

}); // end of ready
            
          
!
999px
🕑 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.

Console