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

commonMain.ru.casperix.spine.json.component.AnimationJson.kt Maven / Gradle / Ivy

The newest version!
package ru.casperix.spine.json.component

import kotlinx.serialization.Serializable
import ru.casperix.spine.animation.*



@Serializable
class BoneTimelineJson(
    val rotate: List? = null,
    val translate: List? = null,
    val translatex: List? = null,
    val translatey: List? = null,
    val scale: List? = null,
    val scalex: List? = null,
    val scaley: List? = null,
    val shear: List? = null,
    val shearx: List? = null,
    val sheary: List? = null,
)

@Serializable
class SlotAttachment(override val time: Float = 0f, val name: String? = null) : KeyFrame

@Serializable
class SlotColorJson(override val time: Float = 0f, val color: String, val curve: Curve = LinearCurve) : KeyFrame

@Serializable
class SlotTwoColorJson(
    override val time: Float = 0f,
    val light: String,
    val dark: String,
    val curve: Curve = LinearCurve,
) : KeyFrame


@Serializable
class SlotTimelineJson(
    val attachment: List? = null,
    val rgba: List? = null,
    val rgb: List? = null,
    val rgba2: List? = null,
    val rgb2: List? = null,
    val alpha: List? = null,
)


@Serializable
class IKConstraintKeyFrame(
    override val time: Float = 0f,
    val mix: Float = 1f,
    val softness: Float = 0f,
    val bendPositive: Boolean = false,
    val compress: Boolean = false,
    val stretch: Boolean = false,
) : KeyFrame

typealias IKConstraintTimeline = List

@Serializable
class TransformKeyFrame(
    override val time: Float = 0f,
    val rotateMix: Float = 1f,
    val translateMix: Float = 1f,
    val scaleMix: Float = 1f,
    val shearMix: Float = 1f,
) : KeyFrame

typealias TransformConstraintTimeline = List

@Serializable
class PathPositionKeyFrame(
    override val time: Float = 0f,
    val position: Float = 1f,
) : KeyFrame

@Serializable
class PathSpacingKeyFrame(
    override val time: Float = 0f,
    val spacing: Float = 1f,
) : KeyFrame

@Serializable
class PathMixKeyFrame(
    override val time: Float = 0f,
    val rotateMix: Float = 1f,
    val translateMix: Float = 1f,
) : KeyFrame

@Serializable
class PathConstraintTimeline(
    val position: List? = null,
    val spacing: List? = null,
    val mix: List? = null,
)

@Serializable
class DeformKeyFrame(
    override val time: Float = 0f,
    val offset: Int = 0,
    val vertices: List,
    val curve: Curve = LinearCurve,
    val c2: Float = 0f,
    val c3: Float = 1f,
    val c4: Float = 1f,
) : KeyFrame

@Serializable
class EventKeyFrame(
    val name: String,
    /**
     * No default value in documentation.
     * But exist file without field.
     * version: 4.2.22.
     */
    override val time: Float = 0f,
    val int: Int? = null,
    val float: Float? = null,
    val string: String? = null,
    val volume: Float? = null,
    val balance: Float? = null,
) : KeyFrame

typealias EventTimeline = List

@Serializable
class DrawOrderInfo(
    val slot: String,
    val offset: Int,
)

@Serializable
class DrawOrderKeyFrame(
    override val time: Float = 0f,
    val offsets: List,
) : KeyFrame
typealias DrawOrderTimeline = List

@Serializable
class AnimationJson(
    val bones: Map? = null,
    val slots: Map? = null,
    val ik: Map? = null,
    val transform: Map? = null,
    val path: Map? = null,
    val deform: Map>>? = null,//skin->slot->mesh
    val events: EventTimeline? = null,
    val draworder: Map? = null,
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy