From 2f5b2b9597e92f81330276401aebb71f2cce064b Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Sat, 18 Nov 2023 08:27:10 +0100 Subject: [PATCH] [orx-easing] Add Serializable annotations --- orx-easing/build.gradle.kts | 5 +++++ orx-easing/src/commonMain/kotlin/Easing.kt | 2 ++ 2 files changed, 7 insertions(+) diff --git a/orx-easing/build.gradle.kts b/orx-easing/build.gradle.kts index b104cf60..4d829f80 100644 --- a/orx-easing/build.gradle.kts +++ b/orx-easing/build.gradle.kts @@ -1,5 +1,9 @@ plugins { 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 { @@ -12,6 +16,7 @@ kotlin { implementation(libs.openrndr.draw) implementation(libs.openrndr.filter) implementation(libs.kotlin.reflect) + implementation(libs.kotlin.serialization.core) } } diff --git a/orx-easing/src/commonMain/kotlin/Easing.kt b/orx-easing/src/commonMain/kotlin/Easing.kt index d9be89f8..56ef783c 100644 --- a/orx-easing/src/commonMain/kotlin/Easing.kt +++ b/orx-easing/src/commonMain/kotlin/Easing.kt @@ -1,5 +1,6 @@ package org.openrndr.extra.easing +import kotlinx.serialization.Serializable import kotlin.math.* 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, * query its `.size` property or get functions by index. */ +@Serializable enum class Easing(val function: EasingFunction) { Linear(::easeLinear),