style: 优化防抖样式

This commit is contained in:
chenchun
2025-08-01 17:58:07 +08:00
parent 3f8e6e48c0
commit 17f9ac6d54
2 changed files with 61 additions and 26 deletions

View File

@@ -27,6 +27,9 @@ const startAnimate=()=>{
window.addEventListener('resize', () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
centerX = canvas.width / 2;
centerY = canvas.height / 2;
drawStars();
});
createStars(props.number??1000);
@@ -69,7 +72,7 @@ function drawStars() {
function animate() {
drawStars();
// requestAnimationFrame(animate);
// requestAnimationFrame(animate); // 注释掉动画循环以节省性能
}