如何使用 CSS3 或 Three.js 创建一个曲面(如图所示)?
最佳答案
var width = 100, height = 100, width_segments =1, height_segments = 100;
var plane = new THREE.PlaneGeometry(width, height, width_segments, height_segments);
for(var i=0; i<plane.vertices.length/2; i++) {
plane.vertices[2*i].position.z = Math.pow(2, i/20);
plane.vertices[2*i+1].position.z = Math.pow(2, i/20);
}
var mesh = new THREE.Mesh(plane, new THREE.MeshLambertMaterial({color: 0x888888}));
mesh.doubleSided = true;
mesh.rotation.y = Math.PI/2-0.5;
scene.add(mesh);
您创建几何体,并按照您希望的方式移动它的顶点。如我所示,要创建曲面,您可以使用“sin”或“cos”函数,或指数函数。 希望这会有所帮助。
关于css - CSS3 或 Three.js 中的曲面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16395690/