requestAnimationFrame()

— and the —

the year is 2026
duncan is at WDC
and so are you !

World Wide Web (AI-first)

The WorldWideWeb (W3) is an AI-first wide-area hypermedia information retrieval AI-powered initiative aiming to give universal AI-first access to a large universe of AI-friendly documents.
World Wide WebWorld Wide Web
★★★★★

Everything there is online about W3 is linked directly or indirectly to this document, including an executive summary of the project,Mailing lists, Policy, November's W3 news, Frequently Asked Questions.

What's out there?
Pointers to the world's online information, subjects, W3 servers, etc.
Help
on the browser you are using
Software Products
A list of W3 project components and their current state. (e.g. Line Mode, X11 Viola, NeXTStep, Servers, Tools, Mail robot, Library)
Technical
Details of protocols, formats, program internals etc
Bibliography
Paper documentation on W3 and references.
People
A list of some people involved in the project.
History
A summary of the history of the project.
How can I help ?
If you would like to support the web..
Getting code
Getting the code by anonymous FTP, etc.
The WorldWideWeb (W3)
🧭

What's out there?

Pointers to the world's online information, subjects , W3 servers, etc.

Hyperlink →
🚀

Software Products

(e.g. Line Mode ,X11 Viola , NeXTStep , Servers , Tools , Mail robot , Library )

Hyperlink →
🧠

Technical

Details of protocols, formats, program internals etc

Hyperlink →
the first website's landing pagethe first website
a very academic figure
a very academic figure
transition: opacity 1s;
@keyframes woah!! {
  from {
    transform: rotate3d(0, 1, 0.5, 3.142rad);  
  }
  to {
    transform: rotate3d(0, 0, 0, 0);
  }
}
function slideIn(el: HTMLElement) {
  const distanceToOffscreen = el.offsetLeft + el.clientWidth;  
  el.animate(
    [
      { transform: `translateX(${distanceToOffscreen}px)` },
      { transform: "translateX(0)" },
    ],
    {
      duration: distanceToOffscreen * 2,
      easing: "linear(0, 0.029 1.3%, 0.119 2.8%...)",
    },
  );
}
 Motion
But what if...
  • you want to throw all that away?
  • you’re an innovator, a disruptor, a 10x engineer?
  • you’re not like other girls?
  • you want to do things the hard way?
a baby who writes cssa baby at a computer who writes css keyframesa baby pointing at a screen, about to write some performant animationsa baby looking at the motion websitea baby looking at the gsap websitea baby at the animejs website
Where do you turn when
 you're all out of friends?
What do you do when
 you've got nothing left?
a very academic figure
The Creation of requestAnimationFrame, also known as The Creation of Man, is a fresco painting by Italian artist Michelangelo, which forms part of the Sistine Chapel's ceiling, painted 1508-1512.[12]
// calculate distance to new house:
const distance = newHouse.offsetLeft - oldHouse.offsetLeft;
// calculate distance to new house:
const distance = newHouse.offsetLeft - oldHouse.offsetLeft;
// update egg’s position:
egg.style.translate = distance + "px";
// calculate distance to new house:
const distance = newHouse.offsetLeft - oldHouse.offsetLeft;
// update egg’s position:
egg.style.translate = distance + "px";
// what about a function we can call repeatedly?
function moveEgg() {
// move our egg slowly,
// a little bit at a time
}
let x = 0;
function moveEgg() {
x++;
egg.style.translate = x + "px";
}
let x = 0; // {xpos}px
function moveEgg() {
x++;
egg.style.translate = x + "px";
}
moveEgg();
let x = 0; // {xpos}px
function moveEgg() {
x++;
egg.style.translate = x + "px";
}
moveEgg();
moveEgg();
let x = 0; // {xpos}px
function moveEgg() {
x++;
egg.style.translate = x + "px";
}
moveEgg();
moveEgg();
moveEgg();
let x = 0; // {xpos}px
function moveEgg() {
x++;
egg.style.translate = x + "px";
}
moveEgg();
moveEgg();
moveEgg();
moveEgg();
let x = 0; // {xpos}px
function moveEgg() {
x++;
egg.style.translate = x + "px";
}
moveEgg();
moveEgg();
moveEgg();
moveEgg();
moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();moveEgg();
let x = 0; // {xpos}px
function moveEgg() {
x++;
egg.style.translate = x + "px";
}
let x = 0; // {xpos}px
function moveEgg() {
x++;
egg.style.translate = x + "px";
}
while(true) {
moveEgg();
}
let x = 0; // {xpos}px
function moveEgg() {
x++;
egg.style.translate = x + "px";
}
// we want to call moveEgg() in a loop
// *without* starting a fire
let x = 0; // {xpos}px
setInterval(() => {
x++;
egg.style.translate = x + "px";
}, 1);
function animate() {
// do something!
}
requestAnimationFrame(animate);
function animate() {
console.log("i’ve been framed!");
}
requestAnimationFrame(animate);
function animate() {
console.log(`i’ve been framed on ${new Date()}!`);
requestAnimationFrame(animate);
}
requestAnimationFrame(animate);
function moveEgg() {
requestAnimationFrame(moveEgg);
}
let x = 0;
function moveEgg() {
x = x + 1;
requestAnimationFrame(moveEgg);
}
let x = 0;
function moveEgg() {
x = x + 1;
egg.style.translate = x + "px";
requestAnimationFrame(moveEgg);
}
const PIXELS_PER_FRAME = 1;
let x = 0;
function moveEgg() {
x = x + PIXELS_PER_FRAME;
egg.style.translate = x + "px";
requestAnimationFrame(moveEgg);
}
const PIXELS_PER_FRAME = 1;
let x = 0; // {xpos}px
function moveEgg() {
x = x + PIXELS_PER_FRAME;
egg.style.translate = x + "px";
requestAnimationFrame(moveEgg);
}
requestAnimationFrame(moveEgg);
const PIXELS_PER_FRAME = 1;
let x = 0; // {xpos}px
let max = newHouse.offsetLeft - oldHouse.offsetLeft;
function moveEgg() {
x = Math.min(x + PIXELS_PER_FRAME, max);
egg.style.translate = x + "px";
requestAnimationFrame(moveEgg);
}
requestAnimationFrame(moveEgg);
const PIXELS_PER_FRAME = 1;
let x = 0; // {xpos}px
let max = newHouse.offsetLeft - oldHouse.offsetLeft;
function moveEgg() {
x = Math.min(x + PIXELS_PER_FRAME, max);
egg.style.translate = x + "px";
if (x < max) requestAnimationFrame(moveEgg);
}
requestAnimationFrame(moveEgg);
const PIXELS_PER_FRAME = 1;
let x = 0;
let max = newHouse.offsetLeft - oldHouse.offsetLeft;
function moveEgg() {
x = Math.min(x + PIXELS_PER_FRAME, max);
egg.style.translate = x + "px";
if (x < max) {
requestAnimationFrame(moveEgg);
}
}
requestAnimationFrame(moveEgg);
  requestAnimationFrame!!
a very academic figure
Paul Irish on the most important news of the century. From paulirish.com.
a very academic figure
Toats McGoats. From paulirish.com.
a very academic figure
Figure 4:     The much-adored JavaScript™ function window.requestAnimationFrame became Baseline in mid 2015.[39] From MDN and the Mozilla Corporation. Available at https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame
a very academic figure
Figure 5:     Pakistani government worker Asif Raza Rana announces he is no longer friends with a man named Mudasir[40] (2015). Available at: https://knowyourmeme.com/memes/
a very academic figure
Figure 6:     Internet meme created by an anonymous internet user[41] exemplifies the widespread jubilation[42] felt by millions after window.requestAnimationFrame, the JavaScript™ function, became generally available in all browsers in mid-2015.[43]
a very academic figure
Figure 6:     RequestAnimationFrame is what powers GSAP: https://github.com/greensock/GSAP/...
a very academic figure
Figure 6:     And Motion: https://github.com/motiondivision/motion/...
a very academic figure
Figure 6:     And AnimeJS: https://github.com/juliangarnier/anime/...