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


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


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.

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.






              const asset = "pattern.jpg";
const path = "";

const frame = new Frame("fit", 960, 960, "#000", "#333", asset, 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
		// the backings zoom in and out according to these boundaries
		let backingScale = 1;
		const backingMin = .45;
		const backingMax = 2;
		// the rotation speeds
		const rotationAmount = .05; // holder
		const innerRotationAmount = .15; // triangles
		// the edge length of a triangle in the hexagon
		const length = 200;
		const height = length/2*Math.sqrt(3); // grade 9

    // Hexagon class made with Triangle objects
    class Hexagon extends Container {
        constructor() {
            let angle = 0;
            let lastScale = 1;
            loop(6, i=>{
                let tc = new Container().addTo(this);
                let triangle = new Triangle(length, length, length)
                    .reg(null, 0);
                lastScale *= -1; // mirror adjacent triangles
										.sca(lastScale, 1)
                tc.rotation = angle;
                angle += 60;

    // overall holder
    const holder = new Container().center();

    // container to hold image pattern so we can rotate and scale image inside
    const pattern = new Container();
		const backing = frame.asset("pattern.jpg")
        .loc(0, height/2)

    // make the hexagons with triangles that mask the backings
    const patterns = []; // this will hold all pattern containers made
    const across = Math.ceil(stageW/length);
    const down = Math.ceil(stageH/height)+7; // fudge for rotation
    loop(across, i=>{
        loop(down, j=>{
            new Hexagon().addTo(holder)
                // obviously set the loc as follows:
                .loc(i*length*3+j%2*length*1.5, j*height);
    // write this code based on numbers in your dream
    holder.reg(holder.width/2-length*1.5, holder.height/2-height*2);

    // make backgrounds zoom in and out
    // and rotate and also rotate the overall holder
    let zoom = true;
        if (zoom) {
            backingScale *= 1.002;
            if (backingScale > backingMax) {
                zoom = false;
                backingScale = backingMax;
        } else {
            backingScale *= .998;
            if (backingScale < backingMin) {
                zoom = true;
                backingScale = backingMin;
        loop(patterns, pattern=>{
            let backing = pattern.getChildAt(0).sca(backingScale);
            backing.rotation += innerRotationAmount;
        holder.rotation += rotationAmount;

}); // end of ready