Skip to content

Instantly share code, notes, and snippets.

@dilrajsingh1997
Last active June 14, 2022 18:10
Show Gist options
  • Save dilrajsingh1997/c59daeb427e3c28302584db4483d7870 to your computer and use it in GitHub Desktop.
Save dilrajsingh1997/c59daeb427e3c28302584db4483d7870 to your computer and use it in GitHub Desktop.
// we are sending one item to the producerChannel at a time
ItemStateBuilder(
composeCanvasDrawItem = getPathCanvasObject(),
initialX = Random.nextInt(0, (width).toInt()).toFloat(),
initialY = (height - 200f),
)
.animateX(
to = {
initialX
},
animationSpec = {
SinWaveAnimationSpec(durationMillis = 3500, multiplier = 100)
}
)
.animateY(
to = {
height / 2
},
animationSpec = {
tween(durationMillis = 3500, easing = FastOutSlowInEasing)
}
)
.animateAlpha(
to = {
0f
},
animationSpec = {
tween(durationMillis = 5500, easing = LinearEasing)
}
)
.animateAngle(
to = {
1440f
},
animationSpec = {
tween(durationMillis = 2500, easing = FastOutSlowInEasing)
}
)
.animateColor(
to = {
Color.Green
},
animationSpec = {
tween(durationMillis = 2000)
}
)
.animateSize(
to = {
2.0f
},
animationSpec = {
spring(dampingRatio = Spring.DampingRatioHighBouncy)
}
)
.build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment