josh-collinsworth / joco-sveltekit

The home of my static SvelteKit site.
https://joshcollinsworth.com
74 stars 14 forks source link

blog/great-transitions #25

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Ten tips for better CSS transitions and animations - Josh Collinsworth blog

Creating high-quality, polished web animations is both a science and an art. This post covers the best things I've learned over the last decade of crafting web UIs.

https://joshcollinsworth.com/blog/great-transitions

SCPCOEXR commented 1 year ago

Your link to the VSCode Extension is incomplete. https://joshcollinsworth.com/blog/great-transitions#4-less-is-more

josh-collinsworth commented 1 year ago

Thanks! ✅

mgailius commented 1 year ago

Well explained, thanks 🙌

vicocotea commented 1 year ago

Very good article.

Can I suggest another tips that I use for animation, mostly for toggling visibility (or other not animated properties).

If you try to animate visibility, it will immediately switch to hidden or visible.

We generally want the hidden switch at the end of fadeout animation and immediately for the fadein visible switch. We can simply delay the visibility transition.

Simple example with an hidden .element, visible when .active :

.element {
opacity: 0;
visibility: hidden;
transition: opacity .3s, visibility 0s .3s;
}

.element.active {
opacity: 1;
visibility: visible;
transition: opacity .3s, visibility 0s 0s;
}

Note the difference in delay for visibility transition. Transition to visible is immediate (delay 0s), transition to default hidden is delayed for .3s. It leaves time to see the opacity transition.

hasintha commented 1 year ago

Well explained sir

lymeYo commented 3 months ago

Good article and your blog site very good too! Very pleasant to use this ui!)

MarjaE2 commented 1 month ago

I have to block smooth animation, reduce frame rates, hide sidebars, etc. So I think it'd help to either avoid smooth animation, or avoid it if users prefer reduced motion.