dog = illo => {
const body = new Zdog.Shape({
addTo: illo,
stroke: 0,
path: [{ y: 0 }, { y: 30 }],
color: "tomato"
});
const numEyes = 30;
for (let i = 0; i < numEyes; ++i) {
var eyeGroup = new Zdog.Group({
addTo: body,
translate: {
z: (Math.random() - 0.5) * 30,
x: Math.random() * 100,
y: Math.random() * 100
},
scale: Math.random(),
rotate: { y: Zdog.TAU * Math.random() }
});
new Zdog.Ellipse({
addTo: eyeGroup,
width: 160,
height: 80,
fill: true,
color: "white"
});
let iris = new Zdog.Ellipse({
addTo: eyeGroup,
diameter: 70,
color: "#00ccff",
fill: true
});
iris.copy({
diameter: 30,
color: "#006"
});
iris.copy({
diameter: 30,
translate: { x: 15, y: -15 },
color: "white"
});
}
const eyeGroup2 = eyeGroup.copy({
addTo: body,
translate: { x: 100, z: -30 }
});
return (frame, dogs) => {
body.rotate = { z: (Zdog.TAU / 32) * Math.sin(frame / 10) };
};
}