6

CSS3 または Three.js を使用して (図のような)湾曲した平面サーフェスを作成するにはどうすればよいですか?

曲面

4

1 に答える 1

8
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」関数、または指数関数を使用できます。お役に立てれば。

于 2013-05-06T10:15:45.017 に答える