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
	  // NEW IN ZIM OCT (8) - come on in and discuss

    // STYLE can be used to set any parameter on a DisplayObject.
    // For instance: Circle, Blob, Button, Pane, Bitmap, Sprite, etc.
    // These are applied at the time the objects are made.
    // They are cascading with each level overriding the previous level:

    // 1. GENERAL: any style can be specified in general
    // 	corner:30 will make all corners default to 30
    // 2. TYPE: styles for object type can be set to override the general styles
    // 	Button:{corner:0} will make all button corners default to 0
    // 3. GROUP: styles for a group can be set to override the type styles
    // 	homePage:{corner:20} will make all objects of that group default to 20
    // 4. OBJECT: styles applied as parameters to the object override all other styles
    // 	new Button({corner:40}) will make this button have a corner of 40

    // Transformations can also be applied (all are numbers - visible is a Boolean):
    // x, y, rotation, alpha, scale, scaleX, scaleY, regX, regY, skewX, skewY, visible
    // a bounds style has a value of {x:Number, y:Number, width:Number, height:Number}
    // where x and y are optional

    // Any property value can be a ZIM VEE value to make use of ZIM zik (pick)
    // color:[red, green, blue] will pick a random color for each object for which the style is applied
    // x:series([100,200,300]) will place subsequent objects at these locations
    // width:{min:100, max:500} will make objects with a width within this range
    // See Docs on ZIM zik() and ZIM series() for more information

    // The following functions have been added:
    // addTo, center, centerReg, transform, drag, gesture, outline, mov, animate, wiggle
    // Values of true will give default functionality for all but mov, animate and wiggle
    // ZIM DUO configuration objects can be set as a value for any of these
    // example: drag:true;  or  drag:{onTop:false}
    // For animate and wiggle, [] can be put around multiple configuration objects
    // to wiggle in the x and y for instance or run multiple animate calls on the object

    // add:true - has been provided to add to the stage (use addTo for other containers)
    // move:{x:value, y:value} or move:x - mirrors the mov Function style (just adding the e)
    // style:false - will turn off all styles for the selector

    // A value of ignore can be used to exclude any earlier styles and return to the original default.
    // ignore is a ZIM global variable - if zns is true then use zim.ignore or just "ignore".
    // Setting style:false will exclude the object from all styles
    // All DisplayObjects have a style parameter (default true). Set to false to ignore styles.
    // GROUPS
    // All DisplayObjects have a group parameter.
    // This parameter accepts a string or a comma delimited string of multiple groups.
    // The group of components can then be targeted in the Group section of STYLE.
    // A group can contain just one component and act like an ID in CSS.

			STYLE = {
						centerReg:true, // so rectangle spins around center
						color:[blue, green, pink, brown, orange], // will randomly pick
						wiggle:[ // an array for wiggle or for animate lets you do multiple calls
							}, {
						animate:{props:{rotation:360}, time:300, loop:true, ease:"linear"},
    loop(10, ()=>{new Rectangle();});
		timeout(10000, ()=>{
			// all at once
			// stage.loop((item)=>{
			// 	item.animate({x:stageW/2, y:stageH/2, rotation:0}, 700);
			// })
				props:{x:stageW/2, y:stageH/2, rotation:0}, 
			stage.getChildAt(stage.numChildren-2).color = white;			
    // FOOTER
    // call remote script to make ZIM Foundation for Creative Coding icon
    const icon = createIcon(frame); 

}); // 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.