style: 优化防抖样式
This commit is contained in:
@@ -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); // 注释掉动画循环以节省性能
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user