in frontend/src/main/kotlin/org/jetbrains/plugins/template/components/PulsingText.kt [13:46]
fun PulsingText(
text: String,
isLoading: Boolean,
modifier: Modifier = Modifier,
color: Color = Color.White,
fontSize: TextUnit = JewelTheme.defaultTextStyle.fontSize,
fontWeight: FontWeight? = JewelTheme.defaultTextStyle.fontWeight
) {
val alpha = if (isLoading) {
val infiniteTransition = rememberInfiniteTransition(label = "pulsing_text")
infiniteTransition.animateFloat(
initialValue = 0.3f,
targetValue = 1f,
animationSpec = infiniteRepeatable(
animation = tween(
durationMillis = 1000,
easing = FastOutSlowInEasing
),
repeatMode = RepeatMode.Reverse
),
label = "text_alpha"
).value
} else {
1f
}
Text(
text = text,
color = color.copy(alpha = alpha),
fontSize = fontSize,
fontWeight = fontWeight,
modifier = modifier
)
}