Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zdog

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zdog

Round, flat, designer-friendly pseudo-3D engine

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
123K
decreased by-2.83%
Maintainers
1
Weekly downloads
 
Created

What is zdog?

Zdog is a 3D JavaScript engine for canvas and SVG. It is designed to be simple and easy to use, allowing you to create 3D models and animations with a minimal amount of code.

What are zdog's main functionalities?

Creating Shapes

This code demonstrates how to create a basic shape using Zdog. The `Illustration` object is the main container, and the `Shape` object is used to create a simple shape with a specified stroke and color.

const { Illustration, Shape } = require('zdog');

const illo = new Illustration({
  element: '.zdog-canvas',
});

new Shape({
  addTo: illo,
  stroke: 20,
  color: '#636',
});

illo.updateRenderGraph();

Animating Shapes

This code demonstrates how to animate a shape in Zdog. The `animate` function updates the rotation of the shape and re-renders the illustration in each frame.

const { Illustration, Shape, TAU } = require('zdog');

const illo = new Illustration({
  element: '.zdog-canvas',
  dragRotate: true,
});

const shape = new Shape({
  addTo: illo,
  stroke: 20,
  color: '#636',
});

function animate() {
  shape.rotate.y += 0.03;
  illo.updateRenderGraph();
  requestAnimationFrame(animate);
}

animate();

Creating Complex Models

This code demonstrates how to create a more complex model using Zdog. It uses `Group` to combine multiple shapes (`Ellipse` and `Rect`) into a single model.

const { Illustration, Ellipse, Rect, Group } = require('zdog');

const illo = new Illustration({
  element: '.zdog-canvas',
});

const group = new Group({
  addTo: illo,
});

new Ellipse({
  addTo: group,
  diameter: 80,
  stroke: 20,
  color: '#636',
});

new Rect({
  addTo: group,
  width: 60,
  height: 60,
  stroke: 20,
  color: '#E62',
  translate: { x: 40, y: 40 },
});

illo.updateRenderGraph();

Other packages similar to zdog

Keywords

FAQs

Package last updated on 04 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc