Lurker News

Comments (92) 27 threads

Earlier comments
osrec1 reply#
Very interesting! Can I ask, how did you implement the timer in CSS/HTML?

And also, what causes the lack of responsiveness?

James0x572 replies#
The timer itself is a CSS animation with 1000 keyframes evenly spread, that runs once for 999s (just realized it should be running for 1000s, oops!). I can't link to lines in the source code because of the 1.23MB filesize but you can search for "timer" in the raw source to see the relevant code: https://raw.githubusercontent.com/propjockey/css-sweeper/mas...

Here's the part that controls when the animation is running:

    #level-none:not(:checked) ~ #ram #timer::before {
      animation: timer step-end 1;
      animation-duration: 999s;
      animation-fill-mode: forwards;
      --pause-if-won: var(--win-state) paused;
      --pause-if-lost: var(--game-over) paused;
      --pause-if-randommenu: var(--randommenu-visible) paused;
      animation-play-state: var(--pause-if-won, var(--pause-if-lost, var(--pause-if-randommenu, running)));
    }
Though the design is responsive to the width of the window, I suspect you mean how slow it is: it's 1.23MB of HTML + CSS, and clicking anything causes almost everything to redraw. It's only a little laggy on my computer but the idea was to test the limits of what's possible and is expected! :)

Thank you for checking it out!

uxamanda1 reply#
If I understand this timer, is it true that after ~16.5 mins, the game would stop? Are you stopping at 1000 keyframes because of a hard limit or for performance or for?
James0x571 reply#
the timer stops at 999 because that's what it does in the real minesweeper, you can keep playing though!

Continue this thread — 1 reply

nitwit0051 reply#
Can't you simplify this by making each digit a separate animation, with the ones digit running at full speed, the tens digit running at 1/10th speed, and the hundreds digit running at 1/100th speed? Then you'd only need ten keyframe values.
James0x57#
Yes, but I didn't trust them to stay synchronized and it wasn't too difficult to generate the code for 1000 keyframes so I just did that :)
mitchtbaum1 reply#
If this took you, ballpark, 1 month to do, what do you think you would be able to do in a year?
James0x571 reply#
This took ~3.25 days. :)

Since I'm brushing up against the limits of CSS, there's not enough room for a full year :P

angrais1 reply#
What inspired the idea and what was your motivation?
James0x57#
I made a Binary Coded Decimal 7 Segment Display Decoder a couple days prior to starting this: https://github.com/propjockey/bcd7sdd

After that blew up on twitter I tried thinking of something else I could test using checkboxes as the state and MineSweeper just popped in my head since it's pretty much 480 fancy checkboxes.
Motivation was just to see if I could, then to see what the limits are once I realized I'd be able to.
Thanks for checking it out!

divbzero#
I was sad to discover that Minesweeper is no longer bundled by default with Windows.
kristopolous1 reply#
I tried this on a low end smartphone. Might as well have been called MineSwapper
quickthrower2#
The bombs are fork bombs

Load more comments