Skip to content

dissolveEffect ​

基于 TSL 噪声的溶解效果,支持动态控制溶解进度。

用法 ​

ts
import { createDissolveMaterial } from '@threeuse/effects'

const material = createDissolveMaterial({
  threshold: 0.0,
  edgeWidth: 0.05,
  edgeColor: [1, 0.4, 0],
})

// 动画中更新阈值
app.onBeforeRender((delta, elapsed) => {
  material.threshold.value = (Math.sin(elapsed) + 1) / 2
})

参数 ​

参数类型默认值说明
thresholdnumber0.5溶解阈值(0=完整,1=消失)
edgeWidthnumber0.05边缘发光宽度
edgeColor[r,g,b][1,0.5,0]边缘发光颜色

Demo ​

Released under the MIT License.