قم بإنشاء منحنى سبلاين ثنائي الأبعاد ناعم من سلسلة من النقاط. يستخدم هذا داخليًا [page:Interpolations.CatmullRom] لإنشاء المنحنى.
// إنشاء موجة شبيهة بالجيب
const curve = new THREE.SplineCurve( [
new THREE.Vector2( -10, 0 ),
new THREE.Vector2( -5, 5 ),
new THREE.Vector2( 0, 0 ),
new THREE.Vector2( 5, -5 ),
new THREE.Vector2( 10, 0 )
] );
const points = curve.getPoints( 50 );
const geometry = new THREE.BufferGeometry().setFromPoints( points );
const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
// إنشاء الكائن النهائي لإضافته إلى المشهد
const splineObject = new THREE.Line( geometry, material );
points – مصفوفة من نقاط [page:Vector2] التي تحدد المنحنى.
انظر إلى قاعدة [page:Curve] للخصائص المشتركة.
مصفوفة من نقاط [page:Vector2] التي تحدد المنحنى.
انظر إلى قاعدة [page:Curve] للأساليب المشتركة.
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]