feat: 在 App.vue 中优化动画性能,添加页面可见性检测,支持动画暂停和恢复,同时更新粒子背景组件的粒子更新逻辑,提升整体用户体验。
This commit is contained in:
@@ -199,15 +199,14 @@ const animate = () => {
|
||||
const time = Date.now() * 0.00005
|
||||
particles.material.uniforms.time.value = time
|
||||
|
||||
if (time % 2 === 0) {
|
||||
updateParticles()
|
||||
}
|
||||
// 更新粒子位置
|
||||
updateParticles(time)
|
||||
|
||||
renderer.render(scene, camera)
|
||||
}
|
||||
}
|
||||
|
||||
const updateParticles = () => {
|
||||
const updateParticles = (time) => {
|
||||
const positions = particles.geometry.attributes.position.array
|
||||
|
||||
for (let i = 0; i < config.particleCount; i++) {
|
||||
|
Reference in New Issue
Block a user