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

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

The newest version!
package ru.casperix.spine.animation

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import ru.casperix.spine.json.component.Curve
import ru.casperix.spine.json.component.LinearCurve

interface KeyFrame {
    val time: Float
}

interface CurveKeyFrame : KeyFrame {
    val curve: Curve
}

@Serializable
class RotateKeyFrame(
    override val time: Float = 0f,
    override val curve: Curve = LinearCurve,
    /**
     * Doc say "angle".
     * But file and runtimes uses "value"
     * 4.2.22
     */
    @SerialName("value")
    val angle: Float = 0f,
) : CurveKeyFrame

@Serializable
class TranslateKeyFrame(
    override val time: Float = 0f,
    override val curve: Curve = LinearCurve,
    val x: Float = 0f,
    val y: Float = 0f,
) : CurveKeyFrame

@Serializable
class ScaleKeyFrame(
    override val time: Float = 0f,
    override val curve: Curve = LinearCurve,
    val x: Float = 1f,
    val y: Float = 1f,
) : CurveKeyFrame

@Serializable
class ShearKeyFrame(
    override val time: Float = 0f,
    override val curve: Curve = LinearCurve,
    val x: Float = 0f,
    val y: Float = 0f,
) : CurveKeyFrame




© 2015 - 2024 Weber Informatics LLC | Privacy Policy