diff --git a/src/main/kotlin/de/moritzruth/lampenfieber/act/Second.kt b/src/main/kotlin/de/moritzruth/lampenfieber/act/Second.kt index 524db83..cf68262 100644 --- a/src/main/kotlin/de/moritzruth/lampenfieber/act/Second.kt +++ b/src/main/kotlin/de/moritzruth/lampenfieber/act/Second.kt @@ -111,7 +111,7 @@ fun ShowBuilderContext.secondAct() = act("Zweiter Akt") { Tops.both.forEach { it.brightness.fade(20.percent, 5.seconds) it.colorWheelMode.static(FuturelightDmh160.ColorWheelMode.Orange) - it.prismMode.static(FuturelightDmh160.PrismMode.FACETS_8) + it.prismMode.static(FuturelightDmh160.PrismMode.FROST) it.startRoomMovement(3.0) } } diff --git a/src/main/kotlin/de/moritzruth/lampenfieber/act/Third.kt b/src/main/kotlin/de/moritzruth/lampenfieber/act/Third.kt index 02125e3..1bcace8 100644 --- a/src/main/kotlin/de/moritzruth/lampenfieber/act/Third.kt +++ b/src/main/kotlin/de/moritzruth/lampenfieber/act/Third.kt @@ -321,7 +321,7 @@ fun ShowBuilderContext.thirdAct() = act("Dritter Akt") { Tops.both.forEach { it.colorWheelMode.static(FuturelightDmh160.ColorWheelMode.DarkBlue) - it.prismMode.static(FuturelightDmh160.PrismMode.FACETS_8) + it.prismMode.static(FuturelightDmh160.PrismMode.FROST) it.prismRotationSpeed.static(20.percent) it.startRoomMovement(8.0) } diff --git a/src/main/kotlin/de/moritzruth/lampenfieber/device/FuturelightDmh160.kt b/src/main/kotlin/de/moritzruth/lampenfieber/device/FuturelightDmh160.kt index 4566c8a..1b2ddea 100644 --- a/src/main/kotlin/de/moritzruth/lampenfieber/device/FuturelightDmh160.kt +++ b/src/main/kotlin/de/moritzruth/lampenfieber/device/FuturelightDmh160.kt @@ -12,7 +12,6 @@ import de.moritzruth.theaterdsl.value.degrees import kotlinx.collections.immutable.persistentSetOf import kotlin.math.roundToInt import kotlin.time.Duration.Companion.minutes -import kotlin.time.Duration.Companion.seconds class FuturelightDmh160(override val firstChannel: DmxAddress, private val isRight: Boolean) : Device { companion object { @@ -90,10 +89,10 @@ class FuturelightDmh160(override val firstChannel: DmxAddress, private val isRig val prismMode = ConcreteDV(PrismMode.OPEN) val prismRotationSpeed = PercentageDV() - fun startRoomMovement(rotationsPerMinute: Double) { - // TODO: Ersetzen durch ellipse - pan.sine(1.minutes / rotationsPerMinute, 0.degrees, 360.degrees) - tilt.fade(120.degrees, 3.seconds) + fun startRoomMovement(rotationsPerMinute: Double) { // TODO: Test + val period = 1.minutes / rotationsPerMinute + pan.rampUp(period) // spin + tilt.sine(period, minimum = 100.degrees, maximum = 120.degrees, start = 120.degrees) } override val dvs = persistentSetOf( diff --git a/src/main/kotlin/de/moritzruth/theaterdsl/device/DynamicValue.kt b/src/main/kotlin/de/moritzruth/theaterdsl/device/DynamicValue.kt index 82c3f3b..df4fec2 100644 --- a/src/main/kotlin/de/moritzruth/theaterdsl/device/DynamicValue.kt +++ b/src/main/kotlin/de/moritzruth/theaterdsl/device/DynamicValue.kt @@ -39,6 +39,7 @@ abstract class DoubleDV(private val initialStaticValue: Double) : DynamicValu } } + data class Ramp(val period: Duration, val start: Double, val end: Double) : State data class Step(val steps: ImmutableList, val interval: Duration, val startIndex: Int) : State data class PulseOnce(val rampUpDuration: Duration, val rampDownDuration: Duration, val peakValue: Double, val start: Double, val end: Double) : State } @@ -70,6 +71,8 @@ abstract class DoubleDV(private val initialStaticValue: Double) : DynamicValu (fromZeroToOne * (s.maximum - s.minimum) + s.minimum) } + is State.Ramp -> elapsedTime.inWholeMilliseconds.rem(s.period.inWholeMilliseconds) * (s.end - s.start) + s.start + is State.Step -> { val index = (elapsedTime / s.interval).toInt() + s.startIndex s.steps[index.mod(s.steps.size)] @@ -114,6 +117,13 @@ abstract class DoubleDV(private val initialStaticValue: Double) : DynamicValu state = State.Sine(fromDomain(minimum), fromDomain(maximum), b, c) } + fun ramp(period: Duration, start: T, end: T) { + state = State.Ramp(period, fromDomain(start), fromDomain(end)) + } + + fun rampUp(period: Duration) = ramp(period, minimumValue, maximumValue) + fun rampDown(period: Duration) = ramp(period, maximumValue, minimumValue) + fun steps(steps: List, interval: Duration, startIndex: Int = 0) { state = State.Step(steps.map(this::fromDomain).toImmutableList(), interval, startIndex) }