SkapaMotionTokens

Subset of Motion Tokens used in Skapa

See also

Samples

import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.*
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.heading
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.sp
import net.ikea.skapa.fonts.latin.NotoIkeaLatin
import net.ikea.skapa.foundation.typography2.SkapaTypeScale

fun main() { 
   //sampleStart 
   SkapaTheme2(darkTheme = isSystemInDarkTheme()) {
    val infiniteTransition = rememberInfiniteTransition(label = "Infinite transition")
    val sizeAnimation by infiniteTransition.animateFloat(
        initialValue = 0f,
        targetValue = 1f,
        animationSpec = infiniteRepeatable(
            animation = tween(
                durationMillis = SkapaMotionTokens.Durations.Slow,
                easing = SkapaMotionTokens.Eases.EaseLinear
            ),
            repeatMode = RepeatMode.Reverse
        ),
        label = "Size animation"
    )

    Box(
        modifier = Modifier.size(SkapaSpacing.space300),
        contentAlignment = Alignment.Center
    ) {
        Box(
            modifier = Modifier
                .size(SkapaSpacing.space300 * sizeAnimation)
                .background(SkapaTheme.colors.neutral7, SkapaBorders.CornerRadius.radiusCap)
        )
    }
} 
   //sampleEnd
}

Types

Link copied to clipboard
object Durations

Skapa animation duration. Values are in milliseconds

Link copied to clipboard
object Eases