commonMain.ru.casperix.spine.animation.RotateTimeline.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 RotateTimeline(
override val boneIndex: Int,
override val frames: List,
) : AbstractTimeline(frames), CurveTimeline1, BoneTimeline {
val rotationFrames = frames.map { createFrame(it.time, it.angle, it.curve, 0) }
override fun apply(context: AnimationContext) = context.run {
val bone = skeleton.bones[boneIndex]
if (bone.isActive) {
val rotation = FrameCalculator.getRelativeValue(rotationFrames, time, weight, blend, bone.local.rotation, bone.data.local.rotation, false)
bone.local = bone.local.copy(rotation = rotation)
}
}
}