Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无限动画 #254

Open
Sunny-117 opened this issue Nov 4, 2022 · 1 comment
Open

无限动画 #254

Sunny-117 opened this issue Nov 4, 2022 · 1 comment

Comments

@Sunny-117
Copy link
Owner

No description provided.

@bearki99
Copy link

const box = document.getElementById('box');
let rotation = 0; // 初始旋转角度为 0

function animate() {
  rotation += 0.1; // 每次旋转增加 0.1 弧度
  box.style.transform = `rotate(${rotation}rad)`; // 更新旋转角度
  requestAnimationFrame(animate); // 请求下一次重绘
}

requestAnimationFrame(animate); // 启动动画

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants