{
const {scene, camera, renderer} = setup()
const sides = 4;
const height = 40;
const capHeight = 5;
const heightSegments = 3;
const radius = 10;
const middle = new THREE.CylinderGeometry(radius, radius, height, sides, heightSegments, true);
const coneTop = new THREE.ConeGeometry(radius, capHeight, sides, heightSegments, true);
const coneBottom = coneTop.clone();
coneTop.translate(0, height / 2 + capHeight / 2, 0);
coneBottom.rotateZ(Math.PI);
coneBottom.translate(0, -height / 2 - capHeight / 2, 0);
const geometry = new THREE.Geometry();
geometry.merge(middle);
geometry.merge(coneTop);
geometry.merge(coneBottom);
const material = new THREE.MeshNormalMaterial({ flatShading: true });
const mesh = new THREE.Mesh(geometry, material)
scene.add(mesh);
const originalVertices = geometry.vertices.map(v => v.clone());
const clock = new THREE.Clock();
while (true) {
const time = clock.getElapsedTime();
mesh.rotation.y = time * 0.25;
geometry.vertices.forEach((vertex, i) => {
const original = originalVertices[i];
vertex.copy(original);
vertex.applyAxisAngle(new THREE.Vector3(0, 1, 0), Math.sin(original.y * 2 + time * 2) * 1);
});
geometry.verticesNeedUpdate = true;
renderer.render(scene, camera);
yield renderer.domElement;
}
}