|
|
@ -1,8 +1,8 @@ |
|
|
import * as THREE from "three"; |
|
|
import * as THREE from 'three' |
|
|
import {CSG} from "three-csg-ts"; |
|
|
import { CSG } from 'three-csg-ts' |
|
|
import gsap from 'gsap' |
|
|
import gsap from 'gsap' |
|
|
//@ts-ignore
|
|
|
//@ts-ignore
|
|
|
import {mergeGeometries} from 'three/addons/utils/BufferGeometryUtils.js' |
|
|
import { mergeGeometries } from 'three/addons/utils/BufferGeometryUtils.js' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default class Clx3dObject extends THREE.Object3D { |
|
|
export default class Clx3dObject extends THREE.Object3D { |
|
|
@ -15,26 +15,26 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
const dd = 0.05 |
|
|
const dd = 0.05 |
|
|
const bd = 0.175 |
|
|
const bd = 0.175 |
|
|
|
|
|
|
|
|
const shape = new THREE.Shape(); |
|
|
const shape = new THREE.Shape() |
|
|
shape.moveTo(-width/2, -depth/2 + bd); |
|
|
shape.moveTo(-width / 2, -depth / 2 + bd) |
|
|
shape.lineTo(-width/2 + bd, -depth/2); |
|
|
shape.lineTo(-width / 2 + bd, -depth / 2) |
|
|
shape.lineTo(width/2 - bd, -depth/2); |
|
|
shape.lineTo(width / 2 - bd, -depth / 2) |
|
|
shape.lineTo(width/2, -depth/2 + bd); |
|
|
shape.lineTo(width / 2, -depth / 2 + bd) |
|
|
|
|
|
|
|
|
shape.lineTo(width/2, -0.285); |
|
|
shape.lineTo(width / 2, -0.285) |
|
|
shape.lineTo(-0.475, -0.285); |
|
|
shape.lineTo(-0.475, -0.285) |
|
|
shape.lineTo(-0.475, -0.125); |
|
|
shape.lineTo(-0.475, -0.125) |
|
|
shape.lineTo(width/2, -0.125); |
|
|
shape.lineTo(width / 2, -0.125) |
|
|
shape.lineTo(width/2, 0.125); |
|
|
shape.lineTo(width / 2, 0.125) |
|
|
shape.lineTo(-0.475, 0.125); |
|
|
shape.lineTo(-0.475, 0.125) |
|
|
shape.lineTo(-0.475, 0.285); |
|
|
shape.lineTo(-0.475, 0.285) |
|
|
shape.lineTo(width/2, 0.285); |
|
|
shape.lineTo(width / 2, 0.285) |
|
|
|
|
|
|
|
|
shape.lineTo(width/2, depth/2 - bd); |
|
|
shape.lineTo(width / 2, depth / 2 - bd) |
|
|
shape.lineTo(width/2 - bd, depth/2); |
|
|
shape.lineTo(width / 2 - bd, depth / 2) |
|
|
shape.lineTo(-width/2 + bd, depth/2); |
|
|
shape.lineTo(-width / 2 + bd, depth / 2) |
|
|
shape.lineTo(-width/2, depth/2 - bd); |
|
|
shape.lineTo(-width / 2, depth / 2 - bd) |
|
|
shape.closePath(); // 闭合路径
|
|
|
shape.closePath() // 闭合路径
|
|
|
|
|
|
|
|
|
// 拉伸轨迹线
|
|
|
// 拉伸轨迹线
|
|
|
const curve = new THREE.CatmullRomCurve3( |
|
|
const curve = new THREE.CatmullRomCurve3( |
|
|
@ -52,32 +52,32 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
} |
|
|
} |
|
|
// 创建挤出几何体
|
|
|
// 创建挤出几何体
|
|
|
const geometry = new THREE.ExtrudeGeometry(shape, options) |
|
|
const geometry = new THREE.ExtrudeGeometry(shape, options) |
|
|
const material = new THREE.MeshBasicMaterial({color: 0xffdddbca}); |
|
|
const material = new THREE.MeshBasicMaterial({ color: 0xffdddbca }) |
|
|
const mesh = new THREE.Mesh(geometry, material); |
|
|
const mesh = new THREE.Mesh(geometry, material) |
|
|
|
|
|
|
|
|
mesh.updateMatrix() |
|
|
mesh.updateMatrix() |
|
|
|
|
|
|
|
|
// 倒角
|
|
|
// 倒角
|
|
|
const shapeD = new THREE.Shape(); |
|
|
const shapeD = new THREE.Shape() |
|
|
shapeD.moveTo(-0.02, -0.02); |
|
|
shapeD.moveTo(-0.02, -0.02) |
|
|
shapeD.lineTo(0.02, 0.02) |
|
|
shapeD.lineTo(0.02, 0.02) |
|
|
shapeD.lineTo(-0.02, 0.02) |
|
|
shapeD.lineTo(-0.02, 0.02) |
|
|
shapeD.closePath() |
|
|
shapeD.closePath() |
|
|
|
|
|
|
|
|
const shapeDW = new THREE.Shape(); |
|
|
const shapeDW = new THREE.Shape() |
|
|
shapeDW.moveTo(0.02, -0.02); |
|
|
shapeDW.moveTo(0.02, -0.02) |
|
|
shapeDW.lineTo(0.02, 0.02) |
|
|
shapeDW.lineTo(0.02, 0.02) |
|
|
shapeDW.lineTo(-0.02, 0.02) |
|
|
shapeDW.lineTo(-0.02, 0.02) |
|
|
shapeDW.closePath() |
|
|
shapeDW.closePath() |
|
|
|
|
|
|
|
|
const shapeDW1 = new THREE.Shape(); |
|
|
const shapeDW1 = new THREE.Shape() |
|
|
shapeDW1.moveTo(-0.02, -0.02); |
|
|
shapeDW1.moveTo(-0.02, -0.02) |
|
|
shapeDW1.lineTo(0.02, -0.02) |
|
|
shapeDW1.lineTo(0.02, -0.02) |
|
|
shapeDW1.lineTo(-0.02, 0.02) |
|
|
shapeDW1.lineTo(-0.02, 0.02) |
|
|
shapeDW1.closePath() |
|
|
shapeDW1.closePath() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const positionDs:THREE.Vector3[] = [ |
|
|
const positionDs: THREE.Vector3[] = [ |
|
|
new THREE.Vector3(-width / 2, 0.20, -depth / 2 + bd), |
|
|
new THREE.Vector3(-width / 2, 0.20, -depth / 2 + bd), |
|
|
new THREE.Vector3(-width / 2 + bd, 0.20, -depth / 2), |
|
|
new THREE.Vector3(-width / 2 + bd, 0.20, -depth / 2), |
|
|
new THREE.Vector3(width / 2 - bd, 0.20, -depth / 2), |
|
|
new THREE.Vector3(width / 2 - bd, 0.20, -depth / 2), |
|
|
@ -93,7 +93,7 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
|
|
|
|
|
|
for (let i = 0; i < positionDs.length - 1; i++) { |
|
|
for (let i = 0; i < positionDs.length - 1; i++) { |
|
|
|
|
|
|
|
|
const curveD = new THREE.CatmullRomCurve3([positionDs[i], positionDs[i+1]], |
|
|
const curveD = new THREE.CatmullRomCurve3([positionDs[i], positionDs[i + 1]], |
|
|
false, |
|
|
false, |
|
|
'catmullrom', |
|
|
'catmullrom', |
|
|
0) |
|
|
0) |
|
|
@ -101,7 +101,7 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
steps: 1, |
|
|
steps: 1, |
|
|
bevelEnabled: false, |
|
|
bevelEnabled: false, |
|
|
extrudePath: curveD |
|
|
extrudePath: curveD |
|
|
}; |
|
|
} |
|
|
let geometryD: THREE.BufferGeometry = null |
|
|
let geometryD: THREE.BufferGeometry = null |
|
|
if (i == 1) { |
|
|
if (i == 1) { |
|
|
geometryD = new THREE.ExtrudeGeometry(shapeDW, optionsD) |
|
|
geometryD = new THREE.ExtrudeGeometry(shapeDW, optionsD) |
|
|
@ -110,7 +110,7 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
} else { |
|
|
} else { |
|
|
geometryD = new THREE.ExtrudeGeometry(shapeD, optionsD) |
|
|
geometryD = new THREE.ExtrudeGeometry(shapeD, optionsD) |
|
|
} |
|
|
} |
|
|
const meshD = new THREE.Mesh(geometryD, material); |
|
|
const meshD = new THREE.Mesh(geometryD, material) |
|
|
meshD.updateMatrix() |
|
|
meshD.updateMatrix() |
|
|
result = CSG.subtract(result, meshD) |
|
|
result = CSG.subtract(result, meshD) |
|
|
} |
|
|
} |
|
|
@ -123,21 +123,21 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
const width = 0.3 |
|
|
const width = 0.3 |
|
|
const depth = 1.188 |
|
|
const depth = 1.188 |
|
|
const dd = 0.05 |
|
|
const dd = 0.05 |
|
|
const shape = new THREE.Shape(); |
|
|
const shape = new THREE.Shape() |
|
|
shape.moveTo(-0.744, -0.594 + dd); |
|
|
shape.moveTo(-0.744, -0.594 + dd) |
|
|
shape.lineTo(-0.744 + dd, -0.594); |
|
|
shape.lineTo(-0.744 + dd, -0.594) |
|
|
shape.lineTo(-0.744 + width - dd, -0.594); |
|
|
shape.lineTo(-0.744 + width - dd, -0.594) |
|
|
shape.lineTo(-0.744 + width, -0.594 + dd); |
|
|
shape.lineTo(-0.744 + width, -0.594 + dd) |
|
|
|
|
|
|
|
|
shape.lineTo(-0.744 + width, -0.4); |
|
|
shape.lineTo(-0.744 + width, -0.4) |
|
|
shape.lineTo(-0.744 + width - 0.08, -0.4); |
|
|
shape.lineTo(-0.744 + width - 0.08, -0.4) |
|
|
shape.lineTo(-0.744 + width - 0.08, 0.4); |
|
|
shape.lineTo(-0.744 + width - 0.08, 0.4) |
|
|
shape.lineTo(-0.744 + width, 0.4); |
|
|
shape.lineTo(-0.744 + width, 0.4) |
|
|
|
|
|
|
|
|
shape.lineTo(-0.744 + width, -0.594 + depth - dd); |
|
|
shape.lineTo(-0.744 + width, -0.594 + depth - dd) |
|
|
shape.lineTo(-0.744 + width - dd, -0.594 + depth); |
|
|
shape.lineTo(-0.744 + width - dd, -0.594 + depth) |
|
|
shape.lineTo(-0.744 + dd, -0.594 + depth); |
|
|
shape.lineTo(-0.744 + dd, -0.594 + depth) |
|
|
shape.lineTo(-0.744, -0.594 + depth - dd); |
|
|
shape.lineTo(-0.744, -0.594 + depth - dd) |
|
|
// shape.lineTo(-0.728, -0.594 + dd);
|
|
|
// shape.lineTo(-0.728, -0.594 + dd);
|
|
|
// shape.closePath()
|
|
|
// shape.closePath()
|
|
|
|
|
|
|
|
|
@ -171,24 +171,24 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
const dd = 0.05 |
|
|
const dd = 0.05 |
|
|
const fdx = 0.06 |
|
|
const fdx = 0.06 |
|
|
const fdy = 0.03 |
|
|
const fdy = 0.03 |
|
|
const shape = new THREE.Shape(); |
|
|
const shape = new THREE.Shape() |
|
|
|
|
|
|
|
|
shape.moveTo(-0.744 + width - 0.08, -0.4); |
|
|
shape.moveTo(-0.744 + width - 0.08, -0.4) |
|
|
shape.lineTo(-0.744 + width + 0.02, -0.4); |
|
|
shape.lineTo(-0.744 + width + 0.02, -0.4) |
|
|
shape.lineTo(-0.744 + width + 0.02, -0.275); |
|
|
shape.lineTo(-0.744 + width + 0.02, -0.275) |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, -0.275); |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, -0.275) |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24, -0.275 + fdy); |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24, -0.275 + fdy) |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24, -0.135 - fdy); |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24, -0.135 - fdy) |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, -0.135); |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, -0.135) |
|
|
shape.lineTo(-0.744 + width + 0.02, -0.135); |
|
|
shape.lineTo(-0.744 + width + 0.02, -0.135) |
|
|
shape.lineTo(-0.744 + width + 0.02, 0.135); |
|
|
shape.lineTo(-0.744 + width + 0.02, 0.135) |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, 0.135); |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, 0.135) |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24, 0.135 + fdy); |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24, 0.135 + fdy) |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24, 0.275 - fdy); |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24, 0.275 - fdy) |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, 0.275); |
|
|
shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, 0.275) |
|
|
shape.lineTo(-0.744 + width + 0.02, 0.275); |
|
|
shape.lineTo(-0.744 + width + 0.02, 0.275) |
|
|
shape.lineTo(-0.744 + width + 0.02, 0.4); |
|
|
shape.lineTo(-0.744 + width + 0.02, 0.4) |
|
|
shape.lineTo(-0.744 + width - 0.08, 0.4); |
|
|
shape.lineTo(-0.744 + width - 0.08, 0.4) |
|
|
|
|
|
|
|
|
shape.closePath() |
|
|
shape.closePath() |
|
|
|
|
|
|
|
|
@ -209,17 +209,17 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
} |
|
|
} |
|
|
// 创建挤出几何体
|
|
|
// 创建挤出几何体
|
|
|
const geometry = new THREE.ExtrudeGeometry(shape, options) |
|
|
const geometry = new THREE.ExtrudeGeometry(shape, options) |
|
|
const material = new THREE.MeshBasicMaterial({color: 0xffdddbca}); |
|
|
const material = new THREE.MeshBasicMaterial({ color: 0xffdddbca }) |
|
|
const mesh = new THREE.Mesh(geometry, material); |
|
|
const mesh = new THREE.Mesh(geometry, material) |
|
|
mesh.updateMatrix() |
|
|
mesh.updateMatrix() |
|
|
|
|
|
|
|
|
const shapeD = new THREE.Shape(); |
|
|
const shapeD = new THREE.Shape() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shapeD.moveTo(-0.744 + width + 0.02, -0.3); |
|
|
shapeD.moveTo(-0.744 + width + 0.02, -0.3) |
|
|
shapeD.lineTo(-0.744 + width + 0.02 + 1.3, -0.3); |
|
|
shapeD.lineTo(-0.744 + width + 0.02 + 1.3, -0.3) |
|
|
shapeD.lineTo(-0.744 + width + 0.02 + 1.3, 0.3); |
|
|
shapeD.lineTo(-0.744 + width + 0.02 + 1.3, 0.3) |
|
|
shapeD.lineTo(-0.744 + width + 0.02, 0.3); |
|
|
shapeD.lineTo(-0.744 + width + 0.02, 0.3) |
|
|
shape.closePath() |
|
|
shape.closePath() |
|
|
|
|
|
|
|
|
// 拉伸轨迹线
|
|
|
// 拉伸轨迹线
|
|
|
@ -239,7 +239,7 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
} |
|
|
} |
|
|
// 创建挤出几何体
|
|
|
// 创建挤出几何体
|
|
|
const geometryD = new THREE.ExtrudeGeometry(shapeD, optionsD) |
|
|
const geometryD = new THREE.ExtrudeGeometry(shapeD, optionsD) |
|
|
const meshD = new THREE.Mesh(geometryD, material); |
|
|
const meshD = new THREE.Mesh(geometryD, material) |
|
|
|
|
|
|
|
|
meshD.updateMatrix() |
|
|
meshD.updateMatrix() |
|
|
|
|
|
|
|
|
@ -254,20 +254,20 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
const width = 0.08 |
|
|
const width = 0.08 |
|
|
const depth = 0.9 |
|
|
const depth = 0.9 |
|
|
const dd = 0.02 |
|
|
const dd = 0.02 |
|
|
const shape = new THREE.Shape(); |
|
|
const shape = new THREE.Shape() |
|
|
shape.moveTo(-width/2, -depth/2 + dd); |
|
|
shape.moveTo(-width / 2, -depth / 2 + dd) |
|
|
shape.lineTo(-width/2 + dd, -depth/2); |
|
|
shape.lineTo(-width / 2 + dd, -depth / 2) |
|
|
shape.lineTo(width/2 - dd, -depth/2); |
|
|
shape.lineTo(width / 2 - dd, -depth / 2) |
|
|
shape.lineTo(width/2, -depth/2 + dd); |
|
|
shape.lineTo(width / 2, -depth / 2 + dd) |
|
|
shape.lineTo(width/2, depth/2 - dd); |
|
|
shape.lineTo(width / 2, depth / 2 - dd) |
|
|
shape.lineTo(width/2 - dd, depth/2); |
|
|
shape.lineTo(width / 2 - dd, depth / 2) |
|
|
shape.lineTo(-width/2 + dd, depth/2); |
|
|
shape.lineTo(-width / 2 + dd, depth / 2) |
|
|
shape.lineTo(-width/2, depth/2 - dd); |
|
|
shape.lineTo(-width / 2, depth / 2 - dd) |
|
|
shape.closePath() |
|
|
shape.closePath() |
|
|
|
|
|
|
|
|
const shapeBar = new THREE.Shape(); |
|
|
const shapeBar = new THREE.Shape() |
|
|
shapeBar.moveTo(0, 0); // 起点在圆心
|
|
|
shapeBar.moveTo(0, 0) // 起点在圆心
|
|
|
shapeBar.absarc(0, 0, 0.02, 0, Math.PI * 2, false); // 从0到π绘制半圆
|
|
|
shapeBar.absarc(0, 0, 0.02, 0, Math.PI * 2, false) // 从0到π绘制半圆
|
|
|
shapeBar.closePath() |
|
|
shapeBar.closePath() |
|
|
|
|
|
|
|
|
const geometries: THREE.BufferGeometry[] = [] |
|
|
const geometries: THREE.BufferGeometry[] = [] |
|
|
@ -337,25 +337,25 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
steps: 1, |
|
|
steps: 1, |
|
|
bevelEnabled: false, |
|
|
bevelEnabled: false, |
|
|
extrudePath: curveL1 |
|
|
extrudePath: curveL1 |
|
|
}); |
|
|
}) |
|
|
|
|
|
|
|
|
const geometryL2 = new THREE.ExtrudeGeometry(shape, { |
|
|
const geometryL2 = new THREE.ExtrudeGeometry(shape, { |
|
|
steps: 1, |
|
|
steps: 1, |
|
|
bevelEnabled: false, |
|
|
bevelEnabled: false, |
|
|
extrudePath: curveL2 |
|
|
extrudePath: curveL2 |
|
|
}); |
|
|
}) |
|
|
|
|
|
|
|
|
const geometryL3 = new THREE.ExtrudeGeometry(shape, { |
|
|
const geometryL3 = new THREE.ExtrudeGeometry(shape, { |
|
|
steps: 1, |
|
|
steps: 1, |
|
|
bevelEnabled: false, |
|
|
bevelEnabled: false, |
|
|
extrudePath: curveL3 |
|
|
extrudePath: curveL3 |
|
|
}); |
|
|
}) |
|
|
|
|
|
|
|
|
const geometryL4 = new THREE.ExtrudeGeometry(shape, { |
|
|
const geometryL4 = new THREE.ExtrudeGeometry(shape, { |
|
|
steps: 1, |
|
|
steps: 1, |
|
|
bevelEnabled: false, |
|
|
bevelEnabled: false, |
|
|
extrudePath: curveL4 |
|
|
extrudePath: curveL4 |
|
|
}); |
|
|
}) |
|
|
|
|
|
|
|
|
geometries.push(geometryL1, geometryL2, geometryL3, geometryL4) |
|
|
geometries.push(geometryL1, geometryL2, geometryL3, geometryL4) |
|
|
|
|
|
|
|
|
@ -365,8 +365,8 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
private static clxPedestalGeometry: THREE.BufferGeometry = null |
|
|
private static clxPedestalGeometry: THREE.BufferGeometry = null |
|
|
private static clxPillarGeometry: THREE.BufferGeometry = null |
|
|
private static clxPillarGeometry: THREE.BufferGeometry = null |
|
|
private static clxForkGeometry: THREE.BufferGeometry = null |
|
|
private static clxForkGeometry: THREE.BufferGeometry = null |
|
|
private static clxGemelGeometryL: THREE.BufferGeometry = null; |
|
|
private static clxGemelGeometryL: THREE.BufferGeometry = null |
|
|
private static clxGemelGeometryR: THREE.BufferGeometry = null; |
|
|
private static clxGemelGeometryR: THREE.BufferGeometry = null |
|
|
|
|
|
|
|
|
constructor(item: ItemJson, option?: RendererCudOption) { |
|
|
constructor(item: ItemJson, option?: RendererCudOption) { |
|
|
super() |
|
|
super() |
|
|
@ -375,22 +375,22 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
Clx3dObject.clxPedestalGeometry = Clx3dObject.createClxPedestal() |
|
|
Clx3dObject.clxPedestalGeometry = Clx3dObject.createClxPedestal() |
|
|
} |
|
|
} |
|
|
const clxPedestalGeometry = Clx3dObject.clxPedestalGeometry |
|
|
const clxPedestalGeometry = Clx3dObject.clxPedestalGeometry |
|
|
const clxPedestalMaterial = new THREE.MeshPhongMaterial({color: 0xffdddbca}); |
|
|
const clxPedestalMaterial = new THREE.MeshPhongMaterial({ color: 0xffdddbca }) |
|
|
const clxPedestalMesh = new THREE.Mesh(clxPedestalGeometry, clxPedestalMaterial); |
|
|
const clxPedestalMesh = new THREE.Mesh(clxPedestalGeometry, clxPedestalMaterial) |
|
|
|
|
|
|
|
|
if (!Clx3dObject.clxPillarGeometry) { |
|
|
if (!Clx3dObject.clxPillarGeometry) { |
|
|
Clx3dObject.clxPillarGeometry = Clx3dObject.createClxPillar() |
|
|
Clx3dObject.clxPillarGeometry = Clx3dObject.createClxPillar() |
|
|
} |
|
|
} |
|
|
const clxPillarGeometry = Clx3dObject.clxPillarGeometry |
|
|
const clxPillarGeometry = Clx3dObject.clxPillarGeometry |
|
|
const clxPillarMaterial = new THREE.MeshPhongMaterial({color: 0xff6c6956}); |
|
|
const clxPillarMaterial = new THREE.MeshPhongMaterial({ color: 0xff6c6956 }) |
|
|
const clxPillarMesh = new THREE.Mesh(clxPillarGeometry, clxPillarMaterial); |
|
|
const clxPillarMesh = new THREE.Mesh(clxPillarGeometry, clxPillarMaterial) |
|
|
|
|
|
|
|
|
if (!Clx3dObject.clxForkGeometry) { |
|
|
if (!Clx3dObject.clxForkGeometry) { |
|
|
Clx3dObject.clxForkGeometry = Clx3dObject.createClxFork() |
|
|
Clx3dObject.clxForkGeometry = Clx3dObject.createClxFork() |
|
|
} |
|
|
} |
|
|
const clxForkGeometry = Clx3dObject.clxForkGeometry; |
|
|
const clxForkGeometry = Clx3dObject.clxForkGeometry |
|
|
const clxForkMaterial = new THREE.MeshPhongMaterial({color: 0xff444444}); |
|
|
const clxForkMaterial = new THREE.MeshPhongMaterial({ color: 0xff444444 }) |
|
|
const clxForkMesh = new THREE.Mesh(clxForkGeometry, clxForkMaterial); |
|
|
const clxForkMesh = new THREE.Mesh(clxForkGeometry, clxForkMaterial) |
|
|
clxForkMesh.name = 'clxFork' |
|
|
clxForkMesh.name = 'clxFork' |
|
|
|
|
|
|
|
|
if (!Clx3dObject.clxGemelGeometryL) { |
|
|
if (!Clx3dObject.clxGemelGeometryL) { |
|
|
@ -403,14 +403,14 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
} |
|
|
} |
|
|
const clxGemelGeometryR = Clx3dObject.clxGemelGeometryR |
|
|
const clxGemelGeometryR = Clx3dObject.clxGemelGeometryR |
|
|
|
|
|
|
|
|
const clxGemelMaterial = new THREE.MeshPhongMaterial({color: 0xff555555}); |
|
|
const clxGemelMaterial = new THREE.MeshPhongMaterial({ color: 0xff555555 }) |
|
|
const clxGemelMeshL1 = new THREE.Mesh(clxGemelGeometryL, clxGemelMaterial); |
|
|
const clxGemelMeshL1 = new THREE.Mesh(clxGemelGeometryL, clxGemelMaterial) |
|
|
clxGemelMeshL1.name = 'clxGemelMeshL1' |
|
|
clxGemelMeshL1.name = 'clxGemelMeshL1' |
|
|
const clxGemelMeshL2 = new THREE.Mesh(clxGemelGeometryL, clxGemelMaterial); |
|
|
const clxGemelMeshL2 = new THREE.Mesh(clxGemelGeometryL, clxGemelMaterial) |
|
|
clxGemelMeshL2.name = 'clxGemelMeshL2' |
|
|
clxGemelMeshL2.name = 'clxGemelMeshL2' |
|
|
const clxGemelMeshR1 = new THREE.Mesh(clxGemelGeometryR, clxGemelMaterial); |
|
|
const clxGemelMeshR1 = new THREE.Mesh(clxGemelGeometryR, clxGemelMaterial) |
|
|
clxGemelMeshR1.name = 'clxGemelMeshR1' |
|
|
clxGemelMeshR1.name = 'clxGemelMeshR1' |
|
|
const clxGemelMeshR2 = new THREE.Mesh(clxGemelGeometryR, clxGemelMaterial); |
|
|
const clxGemelMeshR2 = new THREE.Mesh(clxGemelGeometryR, clxGemelMaterial) |
|
|
clxGemelMeshR2.name = 'clxGemelMeshR2' |
|
|
clxGemelMeshR2.name = 'clxGemelMeshR2' |
|
|
|
|
|
|
|
|
const d = 0 |
|
|
const d = 0 |
|
|
@ -420,22 +420,22 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
this.add(clxForkMesh) |
|
|
this.add(clxForkMesh) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ac = Math.asin(d/(2 * 0.8)) |
|
|
const ac = Math.asin(d / (2 * 0.8)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clxGemelMeshL1.position.z = 0.5 - d/4 |
|
|
clxGemelMeshL1.position.z = 0.5 - d / 4 |
|
|
clxGemelMeshL1.position.y = 0.72 |
|
|
clxGemelMeshL1.position.y = 0.72 |
|
|
clxGemelMeshL1.rotation.x = -ac |
|
|
clxGemelMeshL1.rotation.x = -ac |
|
|
|
|
|
|
|
|
clxGemelMeshL2.position.z = 0.5 - d/4 * 3 |
|
|
clxGemelMeshL2.position.z = 0.5 - d / 4 * 3 |
|
|
clxGemelMeshL2.position.y = 0.72 |
|
|
clxGemelMeshL2.position.y = 0.72 |
|
|
clxGemelMeshL2.rotation.x = -ac |
|
|
clxGemelMeshL2.rotation.x = -ac |
|
|
|
|
|
|
|
|
clxGemelMeshR1.position.z = 0.5 - d/4 |
|
|
clxGemelMeshR1.position.z = 0.5 - d / 4 |
|
|
clxGemelMeshR1.position.y = 0.72 |
|
|
clxGemelMeshR1.position.y = 0.72 |
|
|
clxGemelMeshR1.rotation.x = ac |
|
|
clxGemelMeshR1.rotation.x = ac |
|
|
|
|
|
|
|
|
clxGemelMeshR2.position.z = 0.5 - d/4 * 3 |
|
|
clxGemelMeshR2.position.z = 0.5 - d / 4 * 3 |
|
|
clxGemelMeshR2.position.y = 0.72 |
|
|
clxGemelMeshR2.position.y = 0.72 |
|
|
clxGemelMeshR2.rotation.x = ac |
|
|
clxGemelMeshR2.rotation.x = ac |
|
|
|
|
|
|
|
|
@ -445,7 +445,7 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
this.add(clxGemelMeshR2) |
|
|
this.add(clxGemelMeshR2) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
animationShowFork(z: number): gsap.core.Tween { |
|
|
animationShowFork(z: number): Promise<void> { |
|
|
const clxFork = this.getObjectByName('clxFork') |
|
|
const clxFork = this.getObjectByName('clxFork') |
|
|
const clxGemelMeshL1 = this.getObjectByName('clxGemelMeshL1') |
|
|
const clxGemelMeshL1 = this.getObjectByName('clxGemelMeshL1') |
|
|
const clxGemelMeshL2 = this.getObjectByName('clxGemelMeshL2') |
|
|
const clxGemelMeshL2 = this.getObjectByName('clxGemelMeshL2') |
|
|
@ -454,13 +454,13 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
|
|
|
|
|
|
const fy = clxFork.position.y |
|
|
const fy = clxFork.position.y |
|
|
|
|
|
|
|
|
const ac = Math.asin(z/(2 * 0.8)) |
|
|
const ac = Math.asin(z / (2 * 0.8)) |
|
|
|
|
|
|
|
|
// clxGemelMeshL1.position.z = 0.5 - z/4
|
|
|
// clxGemelMeshL1.position.z = 0.5 - z/4
|
|
|
// clxGemelMeshL1.position.y = fy + 0.72
|
|
|
// clxGemelMeshL1.position.y = fy + 0.72
|
|
|
// clxGemelMeshL1.rotation.x = -ac
|
|
|
// clxGemelMeshL1.rotation.x = -ac
|
|
|
gsap.to(clxGemelMeshL1.position, { |
|
|
gsap.to(clxGemelMeshL1.position, { |
|
|
z: 0.5 - z/4, |
|
|
z: 0.5 - z / 4, |
|
|
y: fy + 0.72, |
|
|
y: fy + 0.72, |
|
|
duration: 3, |
|
|
duration: 3, |
|
|
repeat: 0, |
|
|
repeat: 0, |
|
|
@ -476,7 +476,7 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
// clxGemelMeshL2.position.y = fy + 0.72
|
|
|
// clxGemelMeshL2.position.y = fy + 0.72
|
|
|
// clxGemelMeshL2.rotation.x = -ac
|
|
|
// clxGemelMeshL2.rotation.x = -ac
|
|
|
gsap.to(clxGemelMeshL2.position, { |
|
|
gsap.to(clxGemelMeshL2.position, { |
|
|
z: 0.5 - z/4 * 3, |
|
|
z: 0.5 - z / 4 * 3, |
|
|
y: fy + 0.72, |
|
|
y: fy + 0.72, |
|
|
duration: 3, |
|
|
duration: 3, |
|
|
repeat: 0, |
|
|
repeat: 0, |
|
|
@ -493,7 +493,7 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
// clxGemelMeshR1.position.y = fy + 0.72
|
|
|
// clxGemelMeshR1.position.y = fy + 0.72
|
|
|
// clxGemelMeshR1.rotation.x = ac
|
|
|
// clxGemelMeshR1.rotation.x = ac
|
|
|
gsap.to(clxGemelMeshR1.position, { |
|
|
gsap.to(clxGemelMeshR1.position, { |
|
|
z: 0.5 - z/4, |
|
|
z: 0.5 - z / 4, |
|
|
y: fy + 0.72, |
|
|
y: fy + 0.72, |
|
|
duration: 3, |
|
|
duration: 3, |
|
|
repeat: 0, |
|
|
repeat: 0, |
|
|
@ -510,7 +510,7 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
// clxGemelMeshR2.position.y = fy + 0.72
|
|
|
// clxGemelMeshR2.position.y = fy + 0.72
|
|
|
// clxGemelMeshR2.rotation.x = ac
|
|
|
// clxGemelMeshR2.rotation.x = ac
|
|
|
gsap.to(clxGemelMeshR2.position, { |
|
|
gsap.to(clxGemelMeshR2.position, { |
|
|
z: 0.5 - z/4 * 3, |
|
|
z: 0.5 - z / 4 * 3, |
|
|
y: fy + 0.72, |
|
|
y: fy + 0.72, |
|
|
duration: 3, |
|
|
duration: 3, |
|
|
repeat: 0, |
|
|
repeat: 0, |
|
|
@ -523,18 +523,23 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
ease: 'sine.inOut' |
|
|
ease: 'sine.inOut' |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
return gsap.to(clxFork.position, { |
|
|
return new Promise(resolve => { |
|
|
|
|
|
gsap.to(clxFork.position, { |
|
|
z: -z, |
|
|
z: -z, |
|
|
duration: 3, |
|
|
duration: 3, |
|
|
repeat: 0, |
|
|
repeat: 0, |
|
|
ease: 'sine.inOut' |
|
|
ease: 'sine.inOut', |
|
|
|
|
|
onComplete: resolve |
|
|
}) |
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
animationHideFork(): gsap.core.Tween { |
|
|
|
|
|
|
|
|
animationHideFork(): Promise<void> { |
|
|
return this.animationShowFork(0) |
|
|
return this.animationShowFork(0) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
animationUpFork(y: number): gsap.core.Tween { |
|
|
animationUpFork(y: number): Promise<void> { |
|
|
const clxFork = this.getObjectByName('clxFork') |
|
|
const clxFork = this.getObjectByName('clxFork') |
|
|
const clxGemelMeshL1 = this.getObjectByName('clxGemelMeshL1') |
|
|
const clxGemelMeshL1 = this.getObjectByName('clxGemelMeshL1') |
|
|
const clxGemelMeshL2 = this.getObjectByName('clxGemelMeshL2') |
|
|
const clxGemelMeshL2 = this.getObjectByName('clxGemelMeshL2') |
|
|
@ -566,15 +571,18 @@ export default class Clx3dObject extends THREE.Object3D { |
|
|
ease: 'sine.inOut' |
|
|
ease: 'sine.inOut' |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
return gsap.to(clxFork.position, { |
|
|
return new Promise(resolve => { |
|
|
|
|
|
gsap.to(clxFork.position, { |
|
|
y: y, |
|
|
y: y, |
|
|
duration: 3, |
|
|
duration: 3, |
|
|
repeat: 0, |
|
|
repeat: 0, |
|
|
ease: 'sine.inOut' |
|
|
ease: 'sine.inOut', |
|
|
|
|
|
onComplete: resolve |
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
animationDownFork(): gsap.core.Tween { |
|
|
animationDownFork(): Promise<void> { |
|
|
return this.animationUpFork(0) |
|
|
return this.animationUpFork(0) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|