diff --git a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/Easing.kt b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/Easing.kt
index 1374f0f..f2e06a2 100644
--- a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/Easing.kt
+++ b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/Easing.kt
@@ -3,6 +3,11 @@ package cn.rdlevel.rdkt.core.data
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
+/**
+ * The easing function to use for some animations.
+ *
+ * @see Easings.net for more details on the easing functions.
+ */
@Serializable
public enum class Easing {
@SerialName("Linear")
diff --git a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/action/Theme.kt b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/action/Theme.kt
index 077389c..76e3f8a 100644
--- a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/action/Theme.kt
+++ b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/action/Theme.kt
@@ -12,6 +12,9 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonClassDiscriminator
import kotlinx.serialization.json.JsonIgnoreUnknownKeys
+/**
+ * Themes that can be used to set theme in [SetThemeEvent][cn.rdlevel.rdkt.core.events.SetThemeEvent].
+ */
@OptIn(ExperimentalSerializationApi::class)
@Serializable
@JsonClassDiscriminator("preset")
@@ -353,19 +356,49 @@ public sealed interface Theme {
public class ProceduralTree : AbstractTheme()
}
+/**
+ * A theme that has variants.
+ *
+ * @property variant The variant of the theme.
+ */
public sealed interface VariedTheme> : Theme {
public var variant: E
}
+/**
+ * A theme that can have its position adjusted.
+ */
public sealed interface PositionedTheme : Theme {
+ /**
+ * Whether to enable position adjustment for the theme. If false, the position of the theme will be default or unchanged.
+ */
public var enablePosition: Boolean
+ /**
+ * The valid range for the [positionX].
+ */
public val positionXRange: ClosedFloatingPointRange
+ /**
+ * The X position of the theme pixels. The default position is 0.
+ * The valid range depends on the theme, and should be within [positionXRange].
+ *
+ * Will be ignored if [enablePosition] is false.
+ */
public var positionX: Double
+ /**
+ * The duration of the position change animation in beats.
+ *
+ * Will be ignored if [enablePosition] is false.
+ */
public var positionDuration: Double
+ /**
+ * The easing function for the position change animation.
+ *
+ * Will be ignored if [enablePosition] is false.
+ */
public var positionEase: Easing
}
diff --git a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/SetThemeEvent.kt b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/SetThemeEvent.kt
index 493605a..e7c784a 100644
--- a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/SetThemeEvent.kt
+++ b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/SetThemeEvent.kt
@@ -11,6 +11,11 @@ import cn.rdlevel.rdkt.core.serialization.Flatten
import cn.rdlevel.rdkt.core.serialization.flatten
import kotlinx.serialization.*
+/**
+ * Sets the theme for the selected rooms.
+ *
+ * @property theme The theme to set.
+ */
@OptIn(ExperimentalSerializationApi::class)
@Serializable(SetThemeEvent.Serializer::class)
@KeepGeneratedSerializer