Repository: Automattic/pocket-casts-android
File: modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/contextual/Bookmarks.kt (Kotlin)

Code before:
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import au.com.shiftyjelly.pocketcasts.compose.AppTheme
import au.com.shiftyjelly.pocketcasts.compose.components.TextP40
import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvider
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme
import kotlin.math.abs
import kotlin.random.Random
import kotlinx.coroutines.delay
import au.com.shiftyjelly.pocketcasts.images.R as IR

private data class AnimationParams(
    val shouldStart: Boolean,
    val centerOffset: IntOffset,
    val rotationOffset: Int,
)

private const val FIGMA_WIDTH_DP = 202

@Composable
fun BookmarksAnimation(
    modifier: Modifier = Modifier,
    bookmarks: List<BookmarkConfig> = predefinedBookmarks,
) {
    val centerYOffsetPx = LocalDensity.current.run {
        8.dp.toPx().toInt()
    }
    val animationTriggers = remember {
        List(bookmarks.size) {
            val totalOffset = (bookmarks.size - 1) * centerYOffsetPx
            mutableStateOf(
                AnimationParams(
                    shouldStart = false,
                    centerOffset = IntOffset(x = 0, y = totalOffset - (it * centerYOffsetPx)),
                    rotationOffset = Random.nextInt(10),
                ),
            )
        }
    }

    LaunchedEffect("animations") {
        for (i in bookmarks.indices) {
            animationTriggers[i].value = animationTriggers[i].value.copy(shouldStart = true)

Review comment (suggestion):
```suggestion
private const val WIDTH_DP = 202
```

I don't think the app should mention Figma, the rest of the app doesn't.

Code after:
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import au.com.shiftyjelly.pocketcasts.compose.AppTheme
import au.com.shiftyjelly.pocketcasts.compose.components.TextP40
import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvider
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme
import kotlin.math.abs
import kotlin.random.Random
import kotlinx.coroutines.delay
import au.com.shiftyjelly.pocketcasts.images.R as IR

private data class AnimationParams(
    val shouldStart: Boolean,
    val centerOffset: IntOffset,
    val rotationOffset: Int,
)

private const val WIDTH_DP = 202

@Composable
fun BookmarksAnimation(
    modifier: Modifier = Modifier,
    bookmarks: List<BookmarkConfig> = predefinedBookmarks,
) {
    val centerYOffsetPx = LocalDensity.current.run {
        8.dp.toPx().toInt()
    }
    val animationTriggers = remember {
        List(bookmarks.size) {
            val totalOffset = (bookmarks.size - 1) * centerYOffsetPx
            mutableStateOf(
                AnimationParams(
                    shouldStart = false,
                    centerOffset = IntOffset(x = 0, y = totalOffset - (it * centerYOffsetPx)),
                    rotationOffset = Random.nextInt(10),
                ),
            )
        }
    }

    LaunchedEffect("animations") {
        for (i in bookmarks.indices) {
            animationTriggers[i].value = animationTriggers[i].value.copy(shouldStart = true)