clock(three.js 自带时间计算插件)
该对象用于跟踪时间
// 重新渲染动画
// 设置时钟
const clock = new THREE.Clock();
function render() {
//获取时钟运行的总时长
let time = clock.getElapsedTime();
console.log("时钟运行的总时长", time);
let deltaTime = clock.getDelta();
console.log("两次获取时间的间隔时间", deltaTime);
renderer.render(scene, camera);
// 渲染下一帧的时候就会调用render函数
requestAnimationFrame(render);
}
render();
gsap(补间动画插件)
官方文档:https://greensock.com/docs/
快速开始文档:Getting Started with GSAP - Learning Center - GreenSock
安装
npm install gsap
导入
import gsap f