mirror of
https://github.com/pawelorzech/Swoosh.git
synced 2026-03-31 20:15:41 +00:00
feat: add SwooshMotion shared animation specs
This commit is contained in:
parent
cfaba04039
commit
fd46d371fe
1 changed files with 43 additions and 0 deletions
|
|
@ -0,0 +1,43 @@
|
|||
package com.swoosh.microblog.ui.animation
|
||||
|
||||
import androidx.compose.animation.core.FastOutSlowInEasing
|
||||
import androidx.compose.animation.core.FiniteAnimationSpec
|
||||
import androidx.compose.animation.core.spring
|
||||
import androidx.compose.animation.core.tween
|
||||
|
||||
object SwooshMotion {
|
||||
|
||||
// Expressive bounce — FAB entrance, chips, badges. One visible overshoot.
|
||||
fun <T> bouncy(): FiniteAnimationSpec<T> = spring(
|
||||
dampingRatio = 0.65f,
|
||||
stiffness = 400f
|
||||
)
|
||||
|
||||
// Fast snap-back — press feedback, button taps. Settles in ~150ms.
|
||||
fun <T> bouncyQuick(): FiniteAnimationSpec<T> = spring(
|
||||
dampingRatio = 0.7f,
|
||||
stiffness = 1000f
|
||||
)
|
||||
|
||||
// Controlled spring — expand/collapse, dialogs.
|
||||
fun <T> snappy(): FiniteAnimationSpec<T> = spring(
|
||||
dampingRatio = 0.7f,
|
||||
stiffness = 800f
|
||||
)
|
||||
|
||||
// Soft entrance — cards, content reveal.
|
||||
fun <T> gentle(): FiniteAnimationSpec<T> = spring(
|
||||
dampingRatio = 0.8f,
|
||||
stiffness = 300f
|
||||
)
|
||||
|
||||
// Quick tween — fade, color transitions.
|
||||
fun <T> quick(): FiniteAnimationSpec<T> = tween(
|
||||
durationMillis = 200,
|
||||
easing = FastOutSlowInEasing
|
||||
)
|
||||
|
||||
// Stagger delays
|
||||
const val StaggerDelayMs = 50L
|
||||
const val RevealDelayMs = 80L
|
||||
}
|
||||
Loading…
Reference in a new issue