Max
01/27/2021, 10:18 PMDeactivated User
01/28/2021, 7:41 PMtobsef
01/28/2021, 7:57 PMaddJob(stage.launch {
hero.moveTo(nextPos.x, nextPos.y, 260.milliseconds, EASE_IN_OUT_QUAD)
}, hero.hero)
So I run every move animation inside a corutine. To cancel a running Job, before starting the next one, all jobs are stored in a list:
fun addJob(job: Job, hero: Team.Hero) {
val mutableList = animations[hero.number]!!
mutableList.forEach { it.cancel() }
mutableList.clear()
mutableList.add(job)
job.invokeOnCompletion {
mutableList.clear()
}
}
A new job, cancels all in the list, and clears it.
This was my workaround, of the moveto tween which was not canceable (because it retuns no job).Max
01/29/2021, 3:14 PMBaseView?.tween( .. )
is no longer suspend
. Otherwise it works the same.
Will checkout the Animator class. But my guess is that i will still use my new tween as it fits my purpose very goodDeactivated User
01/29/2021, 11:59 PM