commonMain.ru.casperix.spine.animation.AlphaTimeline.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spine-jvm Show documentation
Show all versions of spine-jvm Show documentation
Signals for all occasions
package ru.casperix.spine.animation
class AlphaTimeline(
override val slotIndex: Int,
override val frames: List,
) : AbstractTimeline(frames), CurveTimeline1, SlotTimeline {
private val alphaChannel = SlotColorChannel(frames, 0, { it.value }) { it.alpha }
override fun apply(context: AnimationContext) = context.getSlotContext(slotIndex)?.run {
slot.color = slot.color.copy(alpha = alphaChannel.getCurrentValue(this))
} ?: Unit
}