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.spring
import androidx.compose.animation.core.tween

object SwooshMotion {

    // Expressive bounce — FAB entrance, chips, badges.
    // Tighter damping + higher stiffness = settles faster with less wobble.
    fun <T> bouncy(): FiniteAnimationSpec<T> = spring(
        dampingRatio = 0.7f,
        stiffness = Spring.StiffnessMedium          // 1500f → settles in ~200ms
    )

    // Fast snap-back — press feedback, button taps. Settles in ~100ms.
    fun <T> bouncyQuick(): FiniteAnimationSpec<T> = spring(
        dampingRatio = 0.75f,
        stiffness = Spring.StiffnessMediumLow * 3f  // ~1200f → very fast settle
    )

    // Controlled spring — expand/collapse, dialogs. Critically damped for snappiness.
    fun <T> snappy(): FiniteAnimationSpec<T> = spring(
        dampingRatio = 0.8f,
        stiffness = Spring.StiffnessMedium           // 1500f → no wobble, fast
    )

    // Soft entrance — cards, content reveal. Slightly underdamped for polish.
    fun <T> gentle(): FiniteAnimationSpec<T> = spring(
        dampingRatio = 0.85f,
        stiffness = Spring.StiffnessMediumLow        // 400f → smooth, fast settle
    )

    // Quick tween — fade, color transitions. Reduced from 200ms to 150ms.
    fun <T> quick(): FiniteAnimationSpec<T> = tween(
        durationMillis = 150,
        easing = FastOutSlowInEasing
    )

    // Stagger delays — reduced from 50ms to 35ms for snappier cascades.
    const val StaggerDelayMs = 35L
    // Reveal delay — reduced from 80ms to 50ms for faster sequential reveals.
    const val RevealDelayMs = 50L
}
