动态飞线特效是可视化数据地图中常见的需求之一,鼠标点击的区块作为终点,从其他区块飞线至点击区块,附带颜色变换或者结合粒子动画
// 贝塞尔曲线
const curve = new THREE.QuadraticBezierCurve3(source, center, target)
// 创建曲线
const geometry = new THREE.TubeGeometry(curve, 64, 0.03)
const tubeLineMaterial = new THREE.ShaderMaterial({
transparent:true,
uniforms: {
baseColor: {
value: new THREE.Color(baseColor)
},
finallyColor: {
value: new THREE.Color(finallyColor)
},
time: this.lineTime
},
vertexShader: `
***
`,
fragmentShader: `
***
`
})