commonMain.ru.casperix.spine.animation.BoneTransformChannel.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
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
)
}
}
}