跳至主要內容

Particles

大约 1 分钟

Particles

粒子对象用于生成各种粒子效果,提供了范围、速度、比例、颜色、角度等多种参数化条件,可灵活定制各类粒子效果,继承自Thing,拥有ThingTHREE.Object3D一切属性和方法。

构造

new VT.Particles({
    particle: {
        // 大小
        sizeScale: 1,
        // 位置样式
        positionStyle: "cube",
        // 基础位置
        positionBase: [0, 0.0, 0],
        // 半径
        positionRadius: 0.5,
        // 重要,用来设置扩散大小
        positionSpread: [0, 0, 0],

        // 速度基数
        speedBase: -0.1,
        // 速度扩散
        speedSpread: .2,

        // 大小基数
        sizeBase: 0,
        // 大小扩散
        sizeSpread: 0,

        // 速度样式
        velocityStyle: "cube",
        // 速度基数
        velocityBase: [0, 10, 0],
        // 速度扩散
        velocitySpread: [10, 10, 10],

        // 加速基数
        accelerationBase: [0, -10, 0],

        // 大小,非常重要
        sizeTween: [[0, 0.1], [1, 1]],
        // 透明度,非常重要
        opacityTween: [[0.0, 0.4], [0.75, 0.0]],
        // 颜色值,非常重要
        colorTween: [[0.0, 0.15], [[0.85, 0.85, 0.85], [0.01, 0.01, 0.01]]],
        // 颜色基数
        colorBase: [1.0, 1.0, 1.0],

        // 角度基数
        angleBase: 0,
        // 角度扩散
        angleSpread: 720,
        // 角度速度基数
        angleVelocityBase: 0,
        // 角度速度扩散
        angleVelocitySpread: 720,
        // 角度加速基数
        angleAccelerationBase: 0,
        angleAccelerationSpread: 0,

        // 粒子发射速度
        particlesPerSecond: 100,
        // 粒子死亡时间
        particleDeathAge: 2.0,
        // 粒子贴图
        particleTexture: "",

        // 发射器时间
        emitterAge: 0.0,
        // 发射器死亡时间
        emitterDeathAge: 10000.0,
        // 发射器活动
        emitterAlive: true,
    }
});

属性成员

type

  • 类型: {String} Particles

isParticles

  • 类型: {Boolean} 是否粒子,是,只读,不可改

engine

  • 类型:Engine 粒子引擎

方法

updateParticle

更新粒子

  • updateParticle(particle)
  • 类型:{Function}
  • 参数:
    • particle {Object} 粒子参数,见构造器
  • 返回:无
上次编辑于:
贡献者: dashun