Jbasoo,
@Jbasoo@mastodon.social avatar

I got carried away last night after reading @bramus post on scroll direction detection using #CSS #scrollDrivenAnimations. It turns out you can control #pixelArt sprites in 8 directions! With zero #JS!

https://jamesbasoo.com/blog/scroll-driven-pixel-art-sprite/

Retro style pixel art character walking in various directions

ricard,
@ricard@ricard.social avatar

@Jbasoo So smart, love it!

reconbot,
@reconbot@toot.cafe avatar

@Jbasoo @bramus this is awesome!

kizu,
@kizu@front-end.social avatar

@Jbasoo @bramus I had an idea to do something similar, but never get to do it, nice to see it working :D

The scroll-persisted state you mention is this article — https://johannesodland.github.io/state/scroll-snap/scroll-driven-animations/2023/06/18/scroll-persisted-state.html — from @johannes

And another idea I had was that it should be possible to create some gameplay based on it and the various scroll positions, like tiles stepping on which would result in “game over”, or “gathering” items etc, as we can pre-calculate the items positions and detect these, toggling the states.

Jbasoo,
@Jbasoo@mastodon.social avatar

@kizu Ha, thanks, and thanks for the persistent state reference, I might look into that. I was thinking something similar regarding gameplay, if style queries had a range syntax then you might be able set up areas for items or danger/safe zones.

kizu,
@kizu@front-end.social avatar

@Jbasoo Yep, for now for the areas we could use separate animations with the timeline-range handling the “areas” where the animations would trigger themselves.

bramus,
@bramus@front-end.social avatar

@Jbasoo SO COOL! 🤩

Jbasoo,
@Jbasoo@mastodon.social avatar

@bramus Thanks! I can see there being a lot of wild applications of direction detection in the future.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • CSS
  • DreamBathrooms
  • ngwrru68w68
  • modclub
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • GTA5RPClips
  • provamag3
  • ethstaker
  • normalnudes
  • tester
  • osvaldo12
  • everett
  • cubers
  • tacticalgear
  • anitta
  • megavids
  • Leos
  • cisconetworking
  • JUstTest
  • lostlight
  • All magazines