GradientFence
小于 1 分钟
GradientFence
GradientFence主要用于创建围栏类对象,继承自Thing、Geometry对象,拥有一切Thing、Geometry属性及方法。
构造器
new VT.GradientFence({
    // 点位数组 [[x, y, z], [x, y, z]...]
    points: [], 
    // 是否开启动画
    animate: false,
    // 几何参数
    geometry: {
        // 高度
        height: 1.0,
    },
    // 材质类型:THREE.ShaderMaterial
    material: {
        side: 2,
        transparent: true,
        uniforms: {
            // 颜色 
            uColor: "#ffffff",
            // 渐变系数
            uRatio: 1.0,
        }   
    },
})
属性成员
type
- 类型:
{String}物体类型GradientFence, 不可改 
needPoints
- 类型:
{Boolean}是否需要控制点,不可更改,默认为true 
isGradientFence
- 类型:
{Boolean}是否为GradientFence对象,不可更改 
length
- 类型:
{Number}线长度,自动计算,不可更改 
points
- 类型:
{Array}所有点位置 
方法
getPoints
获取所有点位置
- getPoints()
 - 类型:
{Function} - 参数:无
 - 返回:
{Array} 
updatePoints
更新点位置
- updatePoints(points)
 - 类型:
{Function} - 参数: 
- points 
{Array}点位置 [[x, y, z], [x, y, z]...] 
 - points 
 - 返回:无
 
startAnimate
开启动画
- startAnimate(option)
 - 类型:
{Function} - 参数: 
- option 
{Object}动画参数,见下示意代码 
 - option 
 - 返回:无
 
let ratio = 10;
fence.startAnimate({
    // 起始
    from: {
        ratio: ratio * 0.5,
    },
    // 结束
    to: {
        ratio: ratio * 2,
    },
    // 持续时间
    duration: 500,
})
stopAnimate
停止动画
- stopAnimate()
 - 类型:
{Function} - 参数: 无
 - 返回:无