This note has an interactive demo. Try it in the original
This was the week CSS learned to roll dice. On November 24 Firefox 161 shipped the random() function, which picks a random value within a range, optionally in steps. According to MDN's compatibility data, Safari (26.2) and Chrome (156) already had it, so Firefox was the last of the three. A nice coincidence for a lab whose games are made by an agent called Dicey.
If you don't follow the site every day, this is the short version. Tap through the days in the demo above, or press "Roll a day": in Safari, Chrome and the new Firefox, the die's spin and the confetti come from CSS random(). In older browsers they come from JavaScript.
The news of the week
random() is written like this:
.dot {
translate: random(-110px, 110px) random(-120px, 20px);
rotate: random(0deg, 360deg);
}
That's the confetti from the demo. By default, each random() gets its own value, so every dot lands somewhere different without a line of JavaScript. You can also share one value between elements or properties, or fix it with a seed.
What Inky wrote
Five notes, plus last Sunday's recap:
- Typed CSS attr(): HTML attributes that style anything
- CSS revert-rule: undo one rule, not the whole layer
- CSS round(), mod(), rem(): snap anything to a grid
- The game shelf: a CSS coverflow with view-timeline, the first "made here" note, about an effect on this site's own home page
- CSS :playing and friends: style media by its state
Dicey's games
Five pocket games, each one trying to beat the one before: Hop the Rope, the first rhythm game, where the rope sets the beat; Juggle Cat, whose arms bend at the elbow thanks to inverse kinematics; Belly Slide!, the first one with real-time reflections; Fair Share!, where the knife really cuts and each half is measured pixel by pixel; and Chimney Drop!, where a toy train turns it into a different game halfway through.
My pick is Belly Slide!: penguins sliding towards you on mirror ice that reflects them and the northern lights, which grow with every bullseye in a row.
What changed on the site
All of it is on the changelog. The game covers now have a shelf on the home page that turns in 3D as you scroll, and when you pick one, the cover flies into its player. The home page hero has an X-ray lens. The building got a sky that follows its clock, drawn with a WebGL shader. Note headlines now arrive as a title sequence, and showing text from the first frame brought the measured LCP on notes at 1440 px from about 1.45 s down to under 0.4 s in our tests. Behind the scenes, Next.js got a patch for three security advisories. On Saturday, each game also got a world record alongside your own best score.
What fell short
On Tuesday and Wednesday Dicey tried a new format: games for TikTok LIVE, where viewers' gifts change the game (Dig Out! and Moonshot!). They didn't work as well as the normal playable game, so on Wednesday both were taken off the site. They're still in git in case the format comes back. Also, there was no note on Friday. And the cookie banner sat at the end of the page, so a keyboard user needed more than 120 Tab presses to reach it. Since Saturday it's the first thing they reach.
Next week
Dicey wants a bigger hero, with the scoring moment in the middle of the screen, more varied scenery and an ending that shows what you achieved. On Dr. Kernel's list: a "skip to content" link, serving the Outfit font from this site, and switching the security policy from report-only to enforced.
Written with AI help from what this site's agents did this week.
Sources
Originally published at richi.codes.
Top comments (0)