in app/src/main/java/com/amazonaws/ivs/player/scrollablefeed/common/heartview/PathAnimator.kt [14:35]
fun start(child: ImageView, parent: ViewGroup) {
parent.addView(child, ViewGroup.LayoutParams(configuration.heartWidth, configuration.heartHeight))
val animation = FloatAnimation(createPath(parent), randomAnimation(), parent, child).apply {
duration = configuration.animDuration.toLong()
interpolator = LinearInterpolator()
setAnimationListener(object : Animation.AnimationListener {
override fun onAnimationRepeat(animation: Animation?) {
/* Ignored */
}
override fun onAnimationEnd(animation: Animation?) {
launchMain {
parent.removeView(child)
}
}
override fun onAnimationStart(animation: Animation?) {
/* Ignored */
}
})
interpolator = LinearInterpolator()
}
child.startAnimation(animation)
}