Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update README.md #303

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

Merged
sudheerj merged 1 commit into sudheerj:master from dharapj:patch-1
Feb 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8842,6 +8842,23 @@ The execution context is created when a function is called. The function's code
**[⬆ Back to Top](#table-of-contents)**

466. ### What is the purpose of requestAnimationFrame method?
The requestAnimationFrame() method in JavaScript is used to schedule a function to be called before the next repaint of the browser window, allowing you to create smooth, efficient animations. It's primarily used for animations and visual updates, making it an essential tool for improving performance when you're animating elements on the web.
```javascript
const element = document.getElementById("myElement");
function animate() {
let currentPosition = parseInt(window.getComputedStyle(element).left, 10);

// Move the element 2px per frame
currentPosition += 2;
element.style.left = currentPosition + 'px';
// If the element hasn't moved off-screen, request the next frame
if (currentPosition < window.innerWidth) {
requestAnimationFrame(animate);
}
}
// Start the animation
requestAnimationFrame(animate);
```

**[⬆ Back to Top](#table-of-contents)**

Expand Down

AltStyle によって変換されたページ (->オリジナル) /