From fd46d371fedd1133ee898d8e26853f55bf7a7716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Orzech?= Date: Thu, 19 Mar 2026 14:06:33 +0100 Subject: [PATCH] feat: add SwooshMotion shared animation specs --- .../microblog/ui/animation/SwooshMotion.kt | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 app/src/main/java/com/swoosh/microblog/ui/animation/SwooshMotion.kt diff --git a/app/src/main/java/com/swoosh/microblog/ui/animation/SwooshMotion.kt b/app/src/main/java/com/swoosh/microblog/ui/animation/SwooshMotion.kt new file mode 100644 index 0000000..ae050fc --- /dev/null +++ b/app/src/main/java/com/swoosh/microblog/ui/animation/SwooshMotion.kt @@ -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 bouncy(): FiniteAnimationSpec = spring( + dampingRatio = 0.65f, + stiffness = 400f + ) + + // Fast snap-back — press feedback, button taps. Settles in ~150ms. + fun bouncyQuick(): FiniteAnimationSpec = spring( + dampingRatio = 0.7f, + stiffness = 1000f + ) + + // Controlled spring — expand/collapse, dialogs. + fun snappy(): FiniteAnimationSpec = spring( + dampingRatio = 0.7f, + stiffness = 800f + ) + + // Soft entrance — cards, content reveal. + fun gentle(): FiniteAnimationSpec = spring( + dampingRatio = 0.8f, + stiffness = 300f + ) + + // Quick tween — fade, color transitions. + fun quick(): FiniteAnimationSpec = tween( + durationMillis = 200, + easing = FastOutSlowInEasing + ) + + // Stagger delays + const val StaggerDelayMs = 50L + const val RevealDelayMs = 80L +}