软件简介

zdog 是一个圆形、扁平、设计师友好的伪3D引擎。

Zdog 灵感来自 Dogz ,Zdog 使用相同的原理。 它使用<canvas>或<svg>中的2D绘图API渲染所有形状。 球体实际上是点。 Toruses实际上是圆圈。 胶囊实际上是粗线。 这是一个简单而有效的技巧。

Zdog在美国用语中被称为“Zee-dog”,在英国被称为“Zed-dog”。

Made with Zdog Made with Zdog Made with Zdog Made with Zdog Made with Zdog Made with Zdog Made with Zdog Made with Zdog Made with Zdog Made with Zdog Made with Zdog Made with Zdog

示例代码

let isSpinning = true;
let illo = new Zdog.Illustration({
element: '.zdog-canvas',
zoom: 4,
dragRotate: true,
// stop spinning when drag starts
onDragStart: function() {
isSpinning = false;
},
});
// circle
new Zdog.Ellipse({
addTo: illo,
diameter: 20,
translate: { z: 10 },
stroke: 5,
color: '#636',
});
// square
new Zdog.Rect({
addTo: illo,
width: 20,
height: 20,
translate: { z: -10 },
stroke: 3,
color: '#E62',
fill: true,
});
function animate() {
illo.rotate.y += isSpinning ? 0.03 : 0;
illo.updateRenderGraph();
requestAnimationFrame( animate );
}
animate();

 

转载自: https://www.oschina.net/p/zdog