Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                const frame = new Frame("fit", 1024, 768, grey, 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
	
	const colors = [red,pink,blue,green,yellow,dark,white,orange];
	function makeCircle() {
		// Each time the series is run it will get the next item in the series
		let s = series(shuffle(colors));
		// Many ZIM parameters accept a ZIM VEE object - or Pick object 
		// Pick Literal formats: 
			// [1,3,2] - random; 
			// {min:10, max:20} - range; 
			// series(1,2,3) - order, 
			// function(){return result;} - function
		// radius, color, borderColor, borderWidth
		let c = new Circle(40, s, s, {min:0, max:5}); 
		new Circle({min:10, max:30}, s, s, {min:0, max:20}).addTo(c);
		return c;
	}
   const t = new Tile({
		obj:makeCircle, 
		cols:9, rows:6, 
		spacingH:15, spacingV:15, 
		align:"center", valign:"center",
		clone:false
	})
		.center()
		.mov(0,-50)
		.animate({props:{scale:0}, from:true, time:500, sequence:40});
	
	// would be better performance with hitTestGrid()
	// see https://codepen.io/zimjs/pen/JjoJLWG
	t.on("mouseover", e=>{e.target.top().animate({scale:2},200)});
	t.on("mouseout",  e=>{e.target.animate({scale:1},600)});
	
	// DOCS FOR ITEMS USED
	// https://zimjs.com/docs.html?item=Frame
	// https://zimjs.com/docs.html?item=Circle
	// https://zimjs.com/docs.html?item=Tile
	// https://zimjs.com/docs.html?item=animate
	// https://zimjs.com/docs.html?item=mov
	// https://zimjs.com/docs.html?item=top
	// https://zimjs.com/docs.html?item=addTo
	// https://zimjs.com/docs.html?item=center
	// https://zimjs.com/docs.html?item=series
	// https://zimjs.com/docs.html?item=zog

	// FOOTER
	// Please see a greeting message - then come visit us at ZIM https://zimjs.com
	const anim = {
		wait:3000,
		from:true,
		props:{alpha:0},
		time:700
	};
	const g = createGreet(100).animate(anim);
	g.rings.animate(anim);
	
	// call remote script to make ZIM Foundation for Creative Coding icon
	createIcon(50); 

}); // end of ready
              
            
!
999px

Console