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", 800, 600, "#EEE", "#555");
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
    // see for video and code tutorials
    // see for documentation
    // see for INTRO to ZIM
    // see for INTRO to CODE

    // CODE HERE
		// make button that we will clone for each page - or user can swipe page
		const goBut = new Button({
				backing:new Triangle(200,200,200,pink).rot(90).reg(null,110),
				rollBacking:new Triangle(200,200,200,blue).rot(90).reg(null,110),
		// Create Pages - just use Containers to hold them
		// for full mode pages, you can use ZIM Layout for responsive design		
		// These can be as complex as you need - with components, windows, interactive works, etc.
		// See the ZIM Badges Art example -
		const page1 = new Container(stageW, stageH); = "PAGE 1"; // optional name to keep track of page later
			new Rectangle(stageW, stageH, green).addTo(page1);
			page1.but = goBut.clone().center(page1);
		const page2 = new Container(stageW, stageH); = "PAGE 2";
			new Rectangle(stageW, stageH, orange).addTo(page2);
			page2.but = goBut.clone().center(page2);
		const page3 = new Container(stageW, stageH); = "PAGE 3";
			new Rectangle(stageW, stageH, yellow).addTo(page3);
			page3.but = goBut.clone().center(page3);
		// make ZIM Pages object 
		const pages = new Pages([
				// imagine pages to the left, right, up and down
				// swipe:["to page on left", "to page on right", etc.s]
				{page:page1, swipe:[page3,page2,"help","help"]},
				{page:page2, swipe:[page1,page3,"help","help"]},
				{page:page3, swipe:[page2,page1,"help","help"]}
		 ],"slide", 500).addTo(); // half second slide when swiped
		// optional - showing can also dispatch events from swipe array
		const pane = new Pane(600, 200, "HELP");
		pages.on("help", (e)=>{
			// or is the current page
			pane.text = "HELP FOR " +;;;
		// can put events on each button or control from ZIM Hotspots
		// use the pages.go() method to transition to the desired page
		// often, this can be coded in a loop - although we have hardcoded it here
		const hotSpots = new HotSpots([
			 {page:page1, rect:page1.but, call:function(){pages.go(page2, "right");}},
			 {page:page2, rect:page2.but, call:function(){pages.go(page3, "right");}},
			 {page:page3, rect:page3.but, call:function(){pages.go(page1, "right");}}
		new Label("ZIM Pages with Swiping and HotSpots").pos(30,30,stage).alp(.5);

    stage.update(); // this is needed to show any changes
    // FOOTER
    // 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.