1class CustomSinCurve extends THREE.Curve {
2 constructor(scale) {
3 super();
4 this.scale = scale;
5 }
6 getPoint(t) {
7 const tx = t * 3 - 1.5;
8 const ty = Math.sin(2 * Math.PI * t);
9 const tz = 0;
10 return new THREE.Vector3(tx, ty, tz).multiplyScalar(this.scale);
11 }
12}
13
14const path = new CustomSinCurve(4);
15const tubularSegments = 20;
16const radius = 1;
17const radialSegments = 8;
18const closed = false;
19const geometry = new THREE.TubeGeometry(
20 path, tubularSegments, radius, radialSegments, closed);