zdog 介绍
zdog 是 一个 圆形、扁平、设计师友好的伪3D引擎。Zdog 灵感来自?Dogz?,Zdog 使用相同的原理。 它使用<canvas>或<svg>中的2D绘图API渲染所有形状。 球体实际上是点。 Toruses实际上是圆圈。 胶囊实际上是粗线。 这是 一个 简单而有效的技巧。
Zdog在美国用语中被称为“Zee-dog”,在英国被称为“Zed-dog”。
示例 代码
let i ssp inning = true;
let illo = new Zdog.Illustration({
element: '.zdog-canvas',
zoom: 4,
dragRotate: true,
// stop spinning when drag starts
onDragStart: function() {
i ssp inning = 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 += i ssp inning ? 0.03 : 0;
illo.updateRende rgraph ();
requestAnimationFrame( animate );
}
animate();
网站地址 : https://zzz.dog
GitHub: https://github.com/metafizzy/zdog
网站描述: 扁平,圆形,设计师友好的伪3D引擎
zdog官方网站
官方网站: https://zzz.dog
如果觉得 网站内容还不错,欢迎将 网站 推荐给程序员好友。