joco-sveltekit icon indicating copy to clipboard operation
joco-sveltekit copied to clipboard

blog/great-transitions

Open utterances-bot opened this issue 2 years ago • 7 comments

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

utterances-bot avatar Mar 09 '23 15:03 utterances-bot

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

SCPCOEXR avatar Mar 09 '23 15:03 SCPCOEXR

Thanks! ✅

josh-collinsworth avatar Mar 09 '23 18:03 josh-collinsworth

Well explained, thanks 🙌

mgailius avatar Mar 14 '23 19:03 mgailius

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.

vicocotea avatar Mar 16 '23 12:03 vicocotea

Well explained sir

hasintha avatar Aug 24 '23 13:08 hasintha

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

lymeYo avatar Aug 09 '24 15:08 lymeYo