All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.ru.casperix.spine.animation.RotateTimeline.kt Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
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)
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy