Re:Show HN: Improve cognitive focus in 1 minute
by myfonj on Wednesday February 07, 2024 @03:30PM
(#39293874)
If you'd like to try those easings straight away, you can use this bare-bones rip-off in interactive sandbox [0]. Still basic: animation is symmetrical, so easing "in" has the same easing as "out", just reversed.
Under 2 kB total. HTML, mostly CSS and literally two lines of JS only for restarting the animation.
[0] https://myfonj.github.io/sandbox.html#%3C!doctype%20html%3E%...
Re:Show HN: Improve cognitive focus in 1 minute
by KTibow on Thursday February 08, 2024 @12:09AM
(#39298464)
Wait, why do you need anything other than CSS? Animations can have easing and loop indefinitely without JS.
Re:Show HN: Improve cognitive focus in 1 minute
by myfonj on Thursday February 08, 2024 @01:22AM
(#39298888)
Sure, you are right about infinite non-interactive CSS animations. And it's true there are simple checkbox:checked or whatever:active hacks for interactivity without JS. But for "click to (re)restart animation" there is no better cross-browser way I am aware of than toggling on some trigger attribute and toggling it off on animation end event, hence the JS.
Re:Show HN: Improve cognitive focus in 1 minute
by myfonj on Friday February 09, 2024 @05:01AM
(#39313282)
Ok, so here is variation that contains zero JS and (ab)uses the "invisible_anchor:focus + sibling_anchor_pointing_to_previous_anchor" trick [0]. I'd prefer the original version, though. This is more or less a hack.
[0] https://myfonj.github.io/sandbox.html#%3C!doctype%20html%3E%...
Re:Show HN: Improve cognitive focus in 1 minute
by dunno7456 on Thursday February 08, 2024 @09:19AM
(#39302176)
Or some Newtonian like in https://www.youtube.com/watch?v=n-txrCMvdms (9m47s)
A suggestion: the pulse animation would look much better with ease-in / ease-out animation curves instead of the harsh linear curve it's currently using. EaseInOutSine from this cheat sheet would do fine: https://easings.net/