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 frame = new Frame("fit", 800, 600, "#EEE", "#555");
frame.on("ready", ()=>{ 
	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;
	const stageW = frame.width;
	const stageH = frame.height;

	// REFERENCES for ZIM at https://zimjs.com
	// see https://zimjs.com/intro.html for an intro example
	// see https://zimjs.com/learn.html for video and code tutorials
	// see https://zimjs.com/docs.html for documentation

	// CODE HERE

	// ZIM Button(width, height, label, backgroundColor, rollBackgroundColor, color, rollColor, borderColor, borderRollColor, borderWidth, 
	// corner, shadowColor, shadowBlur, hitPadding, gradient, gloss, dashed, backing, rollBacking, rollPersist, icon, rollIcon, 
	// toggle, toggleBacking, rollToggleBacking, toggleIcon, rollToggleIcon, toggleEvent, 
	// wait, waitTime, waitBackgroundColor, rollWaitBackgroundColor, waitColor, rollWaitColor, waitModal, waitEnabled, waitBacking, rollWaitBacking, waitIcon, rollWaitIcon,
	// align, valign, indent, indentHorizontal, indentVertical, style, group, inherit)

	// new Button().center().tap(()=>{zgo("http://zimjs.com", "_blank");});

	// Here we will display the buttons in a Tile using a series
	// A series is a function that will return its parameters in order

	const buttons = series(
		
		// ROW 1
		new Button(),
		// custom corner
		new Button({
			label:"ZIM", 
			corner:0, 
			backgroundColor:pink, 
			rollBackgroundColor:green,
			corner:[40,0,40,0]
		}),
		// custom label
		new Button({
			label:new Label({text:"CUSTOM", size:28, rollColor:white}),
			backgroundColor:light,
			rollBackgroundColor:dark,
			borderColor:dark,
			borderWidth:3,
			corner:30
		}),
		
		// ROW 2
		// toggle button with gradient and custom corner
		new Button({
			label:"TOGGLE", 
			toggle:"BACK", 
			corner:0, 
			backgroundColor:blue, 
			rollBackgroundColor:green,
			gradient:.2
		}),
		// using Pizzazz for backing
		new Button({
			label:"GO", 
			backing:pizzazz.makeShape("cloud", dark),
			rollBacking:pizzazz.makeShape("cloud", grey)
		}),
		// little Tile of three icon (from Pizzazz) buttons
		new Tile({
			obj:series(
				new Button({
					label:"", 
					backgroundColor:grey, 
					width:60, 
					corner:8, 
					icon:pizzazz.makeIcon("play", white).alp(.7),
					toggleIcon:pizzazz.makeIcon("pause", white).alp(.7)
				}),
				new Button({
					label:"", 
					backgroundColor:grey, 
					width:60, 
					corner:8, 
					icon:pizzazz.makeIcon("heart", white).alp(.7),
					toggleBacking:new Rectangle({width:60, height:60, color:red, corner:8}).centerReg(null,null,false) // do not add
				}),
				new Button({
					label:"", 
					backgroundColor:grey, 
					width:60, 
					corner:8, 
					icon:pizzazz.makeIcon("sound", white).alp(.7),
					toggleIcon:pizzazz.makeIcon("mute", white).alp(.7)
				})
			),
			cols:3,
			rows:1,
			spacingH:10,
			// clone:false // use the objects passed in (helpful if they have events already)
		}),
		
		// ROW 3 
		// confirmation with wait
		new Button({label:"DELETE", wait:"CONFIRM", waitTime:2000, corner:0, backgroundColor:grey, rollBackgroundColor:red}),
		// loading with wait and Pizzazz
		new Button({
			label:"LOAD",
			color:dark,
			rollColor:dark,
			waitBacking:pizzazz.makePattern({type:"slants", colors:makeSeries([yellow, orange]), interval:500}), 
			backgroundColor:yellow, 
			rollBackgroundColor:green,
			corner:30
		}),			
		new Tabs({
			width:200, 
			tabs:["A","B","C"], 
			backgroundColor:green, 
			rollBackgroundColor:orange, 
			offBackgroundColor:brown,
			corner:20
		})
	);

	
	// The Tile
	const tile = new Tile({
		obj:buttons, 
		cols:3,
		rows:3,
		spacingH:20,
		spacingV:50,
		clone:false // handy if objects already have events on them
	}).center();

	// normally a mousedown or click event would be put on the button
	// here we put the event on the tile and check the text property of the target
	// note the treatment of the wait states for confirming and loading	
	const deleteMessage = new Pane(300, 200, "DELETED");	
	tile.on("mousedown", e=>{
		let button = e.target;
		let text = button.text;
		if (text == "ZIM" || text == "GO") {
			zgo("http://zimjs.com", "_blank");
		} else if (button.waiting && text == "CONFIRM") {
			deleteMessage.show();
			timeout(2000, ()=>{deleteMessage.hide();})
			button.clearWait();
		} else if (!button.waiting && text == "LOAD") {
			timeout(3000, ()=>{button.clearWait();}); // emulating load time - see Frame loadAssets() progress parameter
		}
	});


	new Label("ZIM - Buttons: toggle, backings, icons, wait, patterns, tabs").alp(.7).sca(.7).center().mov(0,-220);

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

	// DOCS FOR ITEMS USED
	// http://zimjs.com/docs.html?item=button
	// http://zimjs.com/docs.html?item=tile
	// http://zimjs.com/docs.html?item=makeSeries
	// http://zimjs.com/docs.html?item=tabs
	// http://zimjs.com/docs.html?item=center
	// http://zimjs.com/docs.html?item=pos
	// http://zimjs.com/docs.html?item=zgo
	// http://zimjs.com/docs.html?item=timeout
	// http://zimjs.com/docs.html?item=pane
	// http://zimjs.com/docs.html?item=label	
	// http://zimjs.com/docs.html?item=frame
	
	// https://zimjs.org/cdn/pizzazz_01.js
	// https://zimjs.org/cdn/pizzazz_02.js
	// https://zimjs.org/cdn/pizzazz_03.js


	// FOOTER
	// call remote script to make ZIM icon - you will not need this
	createIcon(); 

}); // end of ready
              
            
!
999px

Console