球体を作成してシーンに追加します。
segments については、通常2つの値を持つ配列で指定します。
配列でなく1つの数値を指定した場合、その値を2つ持つ配列として扱います。
(例 : segments: 16 は [16, 16] と同じ)
const { camera, create, animate } = init()
camera.position.set(0, 0, 2)
create.ambientLight()
create.directionalLight()
create.sphere()
animate()
const { camera, create, animate } = init()
camera.position.set(0, 0, 2)
create.ambientLight()
create.directionalLight()
const sphere = create.sphere()
animate(({ time }) => {
sphere.position.x = Math.sin(time)
})
const { camera, create, animate } = init()
camera.position.set(0, 0, 4);
create.ambientLight();
create.directionalLight();
create.sphere({
size: 0.5,
position: [-1, 0, 0],
material: "Normal",
});
create.sphere({
size: 0.7,
position: [1, 0, 0],
option: {
// material settings
color: 0x00ff00,
metalness: 0.6,
roughness: 0,
transparent: true,
opacity: 0.5,
},
});
const sphere3 = create.sphere({
size: 1.5,
position: [0, 0, -3],
});
animate(({ time }) => {
sphere3.position.y = Math.sin(time) * 2;
});