[orx-easing] Add Serializable annotations
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
plugins {
|
plugins {
|
||||||
org.openrndr.extra.convention.`kotlin-multiplatform`
|
org.openrndr.extra.convention.`kotlin-multiplatform`
|
||||||
|
// kotlinx-serialization ends up on the classpath through openrndr-math and Gradle doesn't know which
|
||||||
|
// version was used. If openrndr were an included build, we probably wouldn't need to do this.
|
||||||
|
// https://github.com/gradle/gradle/issues/20084
|
||||||
|
id(libs.plugins.kotlin.serialization.get().pluginId)
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
@@ -12,6 +16,7 @@ kotlin {
|
|||||||
implementation(libs.openrndr.draw)
|
implementation(libs.openrndr.draw)
|
||||||
implementation(libs.openrndr.filter)
|
implementation(libs.openrndr.filter)
|
||||||
implementation(libs.kotlin.reflect)
|
implementation(libs.kotlin.reflect)
|
||||||
|
implementation(libs.kotlin.serialization.core)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.openrndr.extra.easing
|
package org.openrndr.extra.easing
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import kotlin.math.*
|
import kotlin.math.*
|
||||||
|
|
||||||
typealias EasingFunction = (Double, Double, Double, Double) -> Double
|
typealias EasingFunction = (Double, Double, Double, Double) -> Double
|
||||||
@@ -297,6 +298,7 @@ fun easeSineInOut(t: Double, b: Double = 0.0, c: Double = 1.0, d: Double = 1.0):
|
|||||||
* Use the `Easing.values()` list to iterate over available functions,
|
* Use the `Easing.values()` list to iterate over available functions,
|
||||||
* query its `.size` property or get functions by index.
|
* query its `.size` property or get functions by index.
|
||||||
*/
|
*/
|
||||||
|
@Serializable
|
||||||
enum class Easing(val function: EasingFunction) {
|
enum class Easing(val function: EasingFunction) {
|
||||||
Linear(::easeLinear),
|
Linear(::easeLinear),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user