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

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

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                const frame = new Frame("fit", 1024, 768, "#111", "#000");
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
    // create a ZIM Blob
    const blob = new Blob({
        color:blue,
        borderColor:pink,
        borderWidth:5,
        controlLength:series(250,120,350,120), // press blob to see
        showControls:false,
        stickColor:light, // if blob is pressed
				editPoints:false, // stop user from adding or removing points
				move:false, // stop user from dragging - all these are optional
        lockControls:true // or set interactive:false to remove controls
    })
        .center()
        // make it bigger than usual (without scaling controls)
        // otherwise could just use .sca(2.5)
        .transformPoints("scale", 2.5);

    // Blob and Squiggle can be created
    // then changed with Bezier points
    // then recorded and recreated
    // see https://zimjs.com/nio/paths.html

    // But in this example, we manipulate the points with code
    // Control points are stored in a pointControls array
    // There are four points (by default) at the top, right, bottom, left
    // Twist the top and bottom
    blob.pointControls[0].rot(180);
    blob.pointControls[2].rot(180);

    // put animation in function so can toggle between sync and no sync
    function makeAnimation(sync) {
        stopAnimate(); // stops all animation
        blob.pointControls[1]						
						.rot(0) // reset rotation 
        		// animate the right and left points in opposite directions
       			.animate({
								props:{rotation:-360},
								ease:"linear",
								loop:true,
								time:3000
						});
        blob.pointControls[3]
						.rot(0)
						.animate({
								props:{rotation:360},
								ease:"linear",
								loop:true,
								time:sync?3000:2800
						});
    }
    makeAnimation(false);

    Ticker.add(()=>{
        blob.update(); // programatically adjusted blobs need updating
    });

    new CheckBox({
        size:30,
        label:"SYNC",
        color:white
    })
        .pos(50,50,false,true)
        .alp(.8)
        .change(e=>{
            makeAnimation(e.target.checked);
        });

    new Label({text:"ZIM Dancing Blob", color:white})
        .pos(30,30)
        .sca(.7)
        .alp(.5);   

    stage.update(); // this is needed to show any changes
  
    // DOCS FOR ITEMS USED
		// https://zimjs.com/docs.html?item=Blob
		// https://zimjs.com/docs.html?item=Label
		// https://zimjs.com/docs.html?item=CheckBox
		// https://zimjs.com/docs.html?item=change
		// https://zimjs.com/docs.html?item=animate
		// https://zimjs.com/docs.html?item=stopAnimate
		// https://zimjs.com/docs.html?item=pos
		// https://zimjs.com/docs.html?item=alp
		// https://zimjs.com/docs.html?item=rot
		// https://zimjs.com/docs.html?item=sca
		// https://zimjs.com/docs.html?item=center
		// https://zimjs.com/docs.html?item=transformPoints
		// https://zimjs.com/docs.html?item=Ticker
		// https://zimjs.com/docs.html?item=Frame
  
    // FOOTER
    // call remote script to make ZIM Foundation for Creative Coding icon
    createIcon(frame); 

}); // end of ready
              
            
!
999px

Console