Skip to content

Instantly share code, notes, and snippets.

@dilrajsingh1997
Created May 31, 2022 11:49
Show Gist options
  • Save dilrajsingh1997/a06c404df523a2ef6b1eb038f58a4342 to your computer and use it in GitHub Desktop.
Save dilrajsingh1997/a06c404df523a2ef6b1eb038f58a4342 to your computer and use it in GitHub Desktop.
data class ItemState constructor(
val id: String = UUID.randomUUID().toString(),
val x: Float,
val y: Float,
val alpha: Float,
val scale: Float,
val angle: Float,
val color: Color,
val xAnimation: Animation<Float, AnimationVector1D>,
val yAnimation: Animation<Float, AnimationVector1D>,
val alphaAnimation: Animation<Float, AnimationVector1D>,
val scaleAnimation: Animation<Float, AnimationVector1D>,
val angleAnimation: Animation<Float, AnimationVector1D>,
val colorAnimation: Animation<Color, AnimationVector4D>,
val time: Long = System.nanoTime(),
val itemToDraw: ComposeCanvasDrawItem,
val terminalCondition: (
interpolatedX: Float,
interpolatedY: Float,
interpolatedAlpha: Float,
interpolatedAngle: Float,
interpolatedColor: Color,
interpolatedScale: Float,
elapsedTimeMillis: Float
) -> Boolean = { interpolatedX, interpolatedY, interpolatedAlpha, _, _, _, _ ->
interpolatedX < 0 || interpolatedY < 0 || interpolatedAlpha < 0.05
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment