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

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

              
                <canvas class="zdog-canvas" width="340" height="340"></canvas>
              
            
!

CSS

              
                .zdog-canvas {
  background: #FDB;
  cursor: move;
}
              
            
!

JS

              
                // Made with Zdog

let isSpinning = true;

let illo = new Zdog.Illustration({
  element: '.zdog-canvas',
  dragRotate: true,
  // stop spinning when drag starts
  onDragStart: function() {
    isSpinning = false;
  },
});

// square front
new Zdog.Rect({
  addTo: illo,
  width: 80,
  height: 80,
  translate: { z: 40 },
  stroke: 20,
  color: '#811',
  fill: true,
});

// square   back
new Zdog.Rect({
  addTo: illo,
  width: 80,
  height: 80,
  translate: { z: -40 },
  stroke: 20,
  color: '#811',
  fill: true,
});

// square side 1
new Zdog.Rect({
  addTo: illo,
  width: 80,
  height: 80,
  rotate: { y: Zdog.TAU/4 },
  translate: { x: 40 },
  stroke: 20,
  color: '#811',
  fill: true,
});

// square side 2
new Zdog.Rect({
  addTo: illo,
  width: 80,
  height: 80,
  rotate: { y: Zdog.TAU/4 },
  translate: { x: -40 },
  stroke: 20,
  color: '#811',
  fill: true,
});

// square top
new Zdog.Rect({
  addTo: illo,
  width: 80,
  height: 80,
  rotate: { x: Zdog.TAU/4 },
  translate: { y: 40 },
  stroke: 20,
  color: '#811',
  fill: true,
});

// square bottom
new Zdog.Rect({
  addTo: illo,
  width: 80,
  height: 80,
  rotate: { x: Zdog.TAU/4 },
  translate: { y: -40 },
  stroke: 20,
  color: '#811',
  fill: true,
});

//Try to create feet. with path and hemisphere.

new Zdog.Shape({
  addTo: illo,
  path: [
    { y: 40 }, // start at 1st point
    { y:  70 }, // line to 2nd point
  ],
  translate: { x: 25 },
  stroke: 10,
});

new Zdog.Shape({
  addTo: illo,
  path: [
    { y: 40 }, // start at 1st point
    { y:  70 }, // line to 2nd point
  ],
  translate: { x: -25 },
  stroke: 10,
});
//add geet as hemispheres

let footr = new Zdog.Hemisphere({
  addTo: illo,
  diameter: 40,
  translate: { y: 85, x:25 },
  rotate: { x: Zdog.TAU/4 },
  // fill enabled by default
  // disable stroke for crisp edge
  stroke: false,
  backface: '#999',
});

let footl = new Zdog.Hemisphere({
  addTo: illo,
  diameter: 40,
  translate: { y: 85, x:-25 },
  rotate: { x: Zdog.TAU/4 },
  // fill enabled by default
  // disable stroke for crisp edge
  stroke: false,
  backface: '#999',
});

//face, eyes as paths

new Zdog.Shape({
  addTo: illo,
  path: [
    { x: -24, y: -14, z:52 }, // start at lower left
    { x:  -16, y: -23, z:52 }, // line to center
        { x:  -8, y: -14, z:52 }, // line to lower right
  ],
  closed: false,
  stroke: 6,
  color: '#111',
});

new Zdog.Shape({
  addTo: illo,
  path: [
    { x: 24, y: -14, z:52 }, // start at lower left
    { x:  16, y: -23, z:52 }, // line to center
        { x:  8, y: -14, z:52 }, // line to lower right
  ],
  closed: false,
  stroke: 6,
  color: '#111',
});
//smile is a path

let smile = new Zdog.Shape({
  addTo: illo,
  path: [
    { x: 24, y: 5, z:52 }, // start at lower left
        { x:  -24, y: 5, z:52 }, // line to lower right
    { x: -24, y: 5, z:52 },   // start
    { arc: [
      { x:  0, y: 70, z:52 }, // corner
      { x:  24, y:5,  z:52 }, // end point
    ]}
  ],
  closed: false,
  stroke: 6,
  color: '#111',
});

///Arms, path and spheres

new Zdog.Shape({
  addTo: illo,
  path: [
    { x:70, y: 0 }, // start at 1st point
    {x:100,  y: -25 }, // line to 2nd point
  ],
  translate: { x: -25 },
  stroke: 8,
});

new Zdog.Shape({
  addTo: illo,
  path: [
    { x:-20, y: 0 }, // start at 1st point
    {x:-50,  y: -25 }, // line to 2nd point
  ],
  translate: { x: -25 },
  stroke: 8,
});

//spheres
new Zdog.Shape({
  addTo: illo,
  // no path set, default to single point
  translate: { x: -72, y:-25 },
  stroke: 20,
  //color: '#111',
});
//spheres
new Zdog.Shape({
  addTo: illo,
  // no path set, default to single point
  translate: { x: 72, y:-25 },
  stroke: 20,
  //color: '#111',
});

new Zdog.Shape({
  addTo: illo,
  visible: false,
  translate: { x: 0, y: 0, z:-45 },
});



/////
function animate() {
  illo.rotate.y += isSpinning ? 0.03 : 0;
  illo.rotate.x += isSpinning ? 0.0005 : 0;
  illo.updateRenderGraph();
  requestAnimationFrame( animate );
}

animate();


              
            
!
999px

Console