Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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 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.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                const assets = "grapefruit.jpg";
const path = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/1604712/";
const frame = new Frame("fit", 1024, 683, "#000", "#000", assets, path);
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 grapefruit = frame.asset("grapefruit.jpg")
					.addTo()
					.animate({
							props:{alpha:0},
							wait:1300,
							time:700,
							rewind:true,
							loop:true,
							rewindWait:400,
							loopWait:400
					});

			const radius = 9;
			const spacing = 6;
			const cols = Math.ceil(stageW/(radius*2+spacing));
			const rows = Math.ceil(stageH/(radius*2+spacing));
			const tiles = new Tile(new Circle(radius,black,black), cols, rows, spacing, spacing)
					.center()
					.alp(0)
					.animate({
							props:{alpha:1},
							wait:1300,
							time:700,
					});
			tiles.loop(tile=>{
					tile.color = grapefruit.getColorAt(tile.x,tile.y)
			});

			stage.on("stagemousedown", ()=>{
					grapefruit.pauseAnimate(!grapefruit.paused);
			});

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

			// 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=pauseAnimate
			// https://zimjs.com/docs.html?item=loop
			// https://zimjs.com/docs.html?item=alp
			// https://zimjs.com/docs.html?item=addTo
			// https://zimjs.com/docs.html?item=center
			// https://zimjs.com/docs.html?item=timeout
			// https://zimjs.com/docs.html?item=zog


			// FOOTER
			// make a greeting - come on in and join us on ZIM Slack!
			timeout(5000, ()=>{
					createGreet(); 
			});	

			// call remote script to make ZIM Foundation for Creative Coding icon
			createIcon(); 

}); // end of ready
              
            
!
999px

Console