Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


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


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.


Auto Save

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.






                const scaling = "fit"; // this will resize to fit inside the screen dimensions
const width = 1024;
const height = 768;
const color = dark; // ZIM has colors but you can use any HTML color "yellow", "#333", etc.
const outerColor = darker;
const assets = "createjs.png";
const path = ""

const frame = new Frame(scaling, width, height, color, outerColor, 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
    // see for video and code tutorials
    // see for documentation
    // see for INTRO to ZIM
    // see for INTRO to CODE

    // CODE HERE
	 // We are going to animate one Squiggle to match another Squiggle 
	 // and then control these animations with a slider
	 // this will probably be integrated into ZIM animate over the next few releases...
	 // but it interesting to see what is under the hood.
	 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	 // NOTE - since this was coded, ZIM has formalized Shape Tweens in ZIM 10.2.0 
	 // see
	 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	 // made letter code here:
    // we have letters for G R A N T and L A N N Y
    // make sure each matching letter has the same number of points
    // to make them morph into the other
    // the type of point does not matter
    // This looks like a lot of work but only took 5 minutes a letter
    // and it is just cut and paste for the code - you never have to make the numbers

    const grant = [
    ]; // expand this to see data
    const lanny = [

    // We will make a Squiggle for each letter
    // we will only animate the GRANT Squiggles
    // and we animate each point and the two control handles
    // to the location of the LANNY point and control handles
    // so we will add both in the same position but hide the LANNY
    // lines will be an array of Squiggles to animate (GRANT)
    // points will be an array of all control points and handles
    // that we are animating in the Squiggles
    const lines = [];
    const points = [];

    // Could loop through the grant array and easily get each letter:
    // loop(grant, (letter, i)=>{});
    // but we need to get the matching lanny letter anyway
    // so looping with the length and i seems a little more consistent
    // as we get to apply i to grant and lanny the same way
    // note that we are hiding lanny with an alpha of 0
    loop(grant.length, i=>{
        // tile each letter across the stage
        let g = new Squiggle({interactive:false, points:grant[i], thickness:30}).loc(120+i*155, stageH/2-100);
        let l = new Squiggle({interactive:false, points:lanny[i], thickness:30}).loc(120+i*155, stageH/2-100).alp(0);
        // store the grant Squiggles in the lines array for later
        // loop through each pointObject
        // this is an array of parts of the points
        loop(g.pointObjects, function (controls, i) {
            // record a reference the matching pointObject of the lanny data
            let target = l.pointObjects[i];
            // loop through the first four elements of the points array
            // the first element is the point container
            // the second is the circle inside (we leave this alone)
            // the third and forth are the two control rectangles
            loop(4, (n) => {
                // skip the circle
                if (n==1) return;
                // add the control to the points array for later
                // animate the control to the location of the lanny control
                // this will animate the whole control container when n=0
                // and the two rectangle control handles when n=2 and n=3
        // throw in an extra color animation on each squiggle
    // pause the animations to let the slider control them
    // this pauses all animations
    // circle.pauseAnimate() would pause animations on the circle
    // pauseAnimate(true, "id"); would pause all animations with id of id
    // circle.pauseAnimate(true, "id"); well... you get the idea

    // we will set the percentComplete of the objects being animated
    // to the slider's currentValue
    // these are all the objects added to the points array
    // and all the Squiggles in the lines array
    // the Squiggles also need to be updated to show any manual changes
    // note how nice ZIM loop is to work with
    Ticker.add(function () {
        loop(points, point=>{
            point.percentComplete = slider.currentValue;
        loop(lines, line=>{
            line.percentComplete = slider.currentValue;

    // create the Slider with custom Button
    const slider = new Slider({
        button:new Button({
        // animate the slider's currentValue property
        // this then is read in the Ticker
        // to change the various animations
    // stop the Slider from being used when animating
    // normally just slider.enabled=false would be fine
    // seems to be a delay when adding cursor during slider creation
    // so enabled false works but cursor still shows
    // adding a timeout lets it work properly - sorry!
    timeout(100, ()=>{slider.enabled = false});

    // add a Button to toggle the Slider from manual to auto
    // note the ZIM Button has toggle built in (plus lots more!)
    new Button({
        .loc(slider.x-150, slider.y)
            // could use an on("click", ()=>{})
            // but tap is chainable so we don't even need a button var
            slider.enabled =;
            // need to sync up animation with slider
            // when we go back to auto...
            // this is tricky with rewind and waits
            // to set animation percent to current slider
            // and I am brain dead!
            // So just start at the beginning...
            if (! slider.currentValue = slider.percentComplete = 0;

    new Label({text:"ZIM - CreateJS Dedication - Grant, Lanny and Team!", color:"white"}).alp(.5).sca(.7).pos(30,30);

    stage.update(); // this is needed to show any changes
    // FOOTER
    // call remote script to make ZIM Foundation for Creative Coding icon

}); // end of ready