three-arrow
v1.0.0
Published
通过threejs生成箭头流动效果
Downloads
5
Maintainers
Readme
如何引入到您的项目中
下载依赖
npm i three-arrow 或者 yarn add three-arrow
如何使用它
1.创建箭头流动
import ThreeArrow from "threeArrow ";
const threeArrow = new ThreeArrow(scene);
//坐标
const points = [{
id: 1,
startPoint: { //起点位置
"x": -5.543314563605337,
"y": 3.522599935531616,
"z": 50.26605357925677
},
endPoint: { //结束位置
"x": -5.592146753353825,
"y": 3.522599935531616,
"z": 60.361867960327483
}
}]
//箭头间距
const spacing = 0.5;
//箭头大小
const size = 0.001
//箭头颜色
const color = 0xff0000;
threeArrow.createWaterFlows(points, spacing, size, color)
2.根据id暂停流动某一条箭头
import ThreeArrow from "threeArrow ";
const threeArrow = new ThreeArrow(scene);
threeArrow.stopWaterFlow(id: string | number);
3.根据id运行流动某一条箭头
import ThreeArrow from "threeArrow ";
const threeArrow = new ThreeArrow(scene);
threeArrow.runWaterFlow(id: string | number);
4.根据id数组暂停流动多条水流
import ThreeArrow from "threeArrow ";
const threeArrow = new ThreeArrow(scene);
threeArrow.stopWaterFlows(ids: string[] | number[]);
5.根据id数组运行流动多条水流
import ThreeArrow from "threeArrow ";
const threeArrow = new ThreeArrow(scene);
threeArrow.runWaterFlows(ids: string[] | number[]);
6.清除定时器(离开页面或者销毁组件时调用)
import ThreeArrow from "threeArrow ";
const threeArrow = new ThreeArrow(scene);
threeArrow.clear();