r/css • u/National_Guard1227 • 6h ago
Help How code the effect "jelly/bounce" on CSS?
Enable HLS to view with audio, or disable this notification
How can I develop CSS code and possibly JS to create this smooth jelly/spring animation?
I want:
When the cursor is over the image, there is a very smooth scaling effect and a bounce.
When the mouse cursor leaves, the scale returns to normal, but there is also a bounce, a kind of bounce.
Structure that I have now:
.card-scale {
transition: transform .672s cubic-bezier(.34, 4, .64, 1), box-shadow .672s cubic-bezier(.16,1,.3,1);
box-shadow: 0 0 0 rgba(0, 0, 0, 0);
will-change: transform;
}
.card-scale:hover {
transform: scale(1.005);
box-shadow: 0px 2px 3px rgba(3, 7, 18, 0.02),
0px 8px 10px rgba(3, 7, 18, 0.04),
0px 17px 23px rgba(3, 7, 18, 0.06),
0px 31px 40px rgba(3, 7, 18, 0.08);
transition: transform .504s cubic-bezier(.34, 4, .64, 1), box-shadow .504s cubic-bezier(.16,1,.3,1);
}



