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

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

There is a newer version: 1.1.1
Show newest version
package ru.casperix.spine.animation

import ru.casperix.math.Transform

class BoneTransformChannel(
    frames: List,
    val isScaleMode:Boolean,
    val channelIndex:Int,
    val valueByFrame: (CustomKeyFrame) -> Float,
    val valueByTransform: (Transform) -> Float,
) {
    private val channelFrames = frames.map { AbstractTimeline.createFrame(it.time, valueByFrame(it), it.curve, channelIndex) }

    fun getCurrentValue(boneAnimationContext: BoneAnimationContext): Float = boneAnimationContext.run {
        boneAnimationContext.context.run {
            FrameCalculator.getRelativeValue(
                channelFrames,
                time,
                weight,
                blend,
                valueByTransform(bone.local),
                valueByTransform(bone.data.local),
                isScaleMode
            )
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy