[orx-keyframer] Add DoubleArrayChannel
This commit is contained in:
@@ -18,7 +18,6 @@ import kotlin.reflect.KProperty1
|
||||
import kotlin.reflect.full.memberProperties
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
|
||||
|
||||
enum class KeyframerFormat {
|
||||
SIMPLE,
|
||||
FULL
|
||||
@@ -97,6 +96,18 @@ open class Keyframer {
|
||||
ColorRGBa(getValue(0), getValue(1), getValue(2))
|
||||
}
|
||||
|
||||
inner class DoubleArrayChannel(keys: Array<String>, defaultValue: DoubleArray = DoubleArray(keys.size)) :
|
||||
CompoundChannel(keys, defaultValue.toTypedArray()) {
|
||||
operator fun getValue(keyframer: Keyframer, property: KProperty<*>): DoubleArray {
|
||||
val result = DoubleArray(keys.size)
|
||||
for (i in keys.indices) {
|
||||
result[i] = getValue(i)
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val channels = mutableMapOf<String, KeyframerChannel>()
|
||||
|
||||
fun loadFromJson(
|
||||
@@ -125,7 +136,7 @@ open class Keyframer {
|
||||
loadFromJsonString(url.readText(), format, parameters, functions)
|
||||
} catch (e: ExpressionException) {
|
||||
throw ExpressionException("Error loading $format from '${url}': ${e.message ?: ""}")
|
||||
} catch(e: IllegalStateException) {
|
||||
} catch (e: IllegalStateException) {
|
||||
throw ExpressionException("Error loading $format from '${url}': ${e.message ?: ""}")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user