diff --git a/src/main/kotlin/de/moritzruth/dracula_musical/act/Testing.kt b/src/main/kotlin/de/moritzruth/dracula_musical/act/Testing.kt index d667621..70c93b1 100644 --- a/src/main/kotlin/de/moritzruth/dracula_musical/act/Testing.kt +++ b/src/main/kotlin/de/moritzruth/dracula_musical/act/Testing.kt @@ -16,6 +16,34 @@ fun ShowBuilderContext.testingAct() = act("Testing") { } } + lightStep(StepCue.Custom("StairvilleSplb.Effect.CHASE_BACK_AND_FORTH")) { + BlinderBars.all { + it.effect.static(StairvilleSplb.Effect.CHASE_BACK_AND_FORTH) + it.effect.speed.static(20.percent) + } + } + + lightStep(StepCue.Custom("StairvilleSplb.Effect.BUMP_INWARDS")) { + BlinderBars.all { + it.effect.static(StairvilleSplb.Effect.BUMP_INWARDS) + it.effect.speed.static(20.percent) + } + } + + lightStep(StepCue.Custom("StairvilleSplb.Effect.FLOW_OUTWARDS")) { + BlinderBars.all { + it.effect.static(StairvilleSplb.Effect.FLOW_OUTWARDS) + it.effect.speed.static(50.percent) + } + } + + lightStep(StepCue.Custom("StairvilleSplb.Effect.FLOW_OUTWARDS_LONG")) { + BlinderBars.all { + it.effect.static(StairvilleSplb.Effect.FLOW_OUTWARDS_LONG) + it.effect.speed.static(50.percent) + } + } + lightStep(StepCue.Custom("StairvilleSplb.Effect.FLOW_INWARDS")) { BlinderBars.all { it.effect.static(StairvilleSplb.Effect.FLOW_INWARDS) diff --git a/src/main/kotlin/de/moritzruth/dracula_musical/device/StairvilleSplb.kt b/src/main/kotlin/de/moritzruth/dracula_musical/device/StairvilleSplb.kt index a8231b8..37e24b3 100644 --- a/src/main/kotlin/de/moritzruth/dracula_musical/device/StairvilleSplb.kt +++ b/src/main/kotlin/de/moritzruth/dracula_musical/device/StairvilleSplb.kt @@ -26,7 +26,6 @@ class StairvilleSplb(override val firstChannel: DmxAddress) : Device { HECTIC_SWITCHING, THEATRE_SWITCHING, CHASE_BACK_AND_FORTH, - CHASE_INWARDS, LAZY_SPARKLES, VOLATILE_SPARKLES, BUMP_INWARDS, diff --git a/src/main/kotlin/de/moritzruth/dracula_musical/device/StairvilleTlbButItsSplb.kt b/src/main/kotlin/de/moritzruth/dracula_musical/device/StairvilleTlbButItsSplb.kt index e181c52..f09eb72 100644 --- a/src/main/kotlin/de/moritzruth/dracula_musical/device/StairvilleTlbButItsSplb.kt +++ b/src/main/kotlin/de/moritzruth/dracula_musical/device/StairvilleTlbButItsSplb.kt @@ -42,11 +42,11 @@ class StairvilleTlbButItsSplb(override val firstChannel: DmxAddress, val inwards start: Percentage = 0.percent, end: Percentage = 0.percent ): Percentage { - return if (time <= rampUpDuration) { + return if (time < rampUpDuration) { val progress = time / rampUpDuration.toDouble() val delta = peak.value - start.value Percentage(progress * delta + start.value) - } else if (time <= rampUpDuration + sustainDuration) { + } else if (time < rampUpDuration + sustainDuration) { peak } else { val progress = min((time - rampUpDuration - sustainDuration) / rampDownDuration.toDouble(), 1.0) @@ -55,7 +55,7 @@ class StairvilleTlbButItsSplb(override val firstChannel: DmxAddress, val inwards } } - fun reverseIndexIfInwardsIsRight(index: Int) = if (inwardsIsRight) NUMBER_OF_SEGMENTS - index else index + fun rIndex(condition: Boolean, index: Int) = if (condition) NUMBER_OF_SEGMENTS - index else index return when (effect) { null -> Array(NUMBER_OF_SEGMENTS) { color } @@ -78,13 +78,15 @@ class StairvilleTlbButItsSplb(override val firstChannel: DmxAddress, val inwards } } - Effect.FLOW_INWARDS, Effect.FLOW_INWARDS_LONG -> { + Effect.FLOW_INWARDS, Effect.FLOW_INWARDS_LONG, Effect.FLOW_OUTWARDS, Effect.FLOW_OUTWARDS_LONG -> { + val isOutwards = effect == Effect.FLOW_OUTWARDS || effect == Effect.FLOW_OUTWARDS_LONG + val isLong = effect == Effect.FLOW_INWARDS_LONG || effect == Effect.FLOW_OUTWARDS_LONG val interval = 1000.0 - val scale = if (effect == Effect.FLOW_INWARDS) 0.5 else 1.5 + val scale = if (isLong) 1.5 else 0.5 Array(NUMBER_OF_SEGMENTS) { index -> val value = Percentage( - sin((time + reverseIndexIfInwardsIsRight(index) * (interval / NUMBER_OF_SEGMENTS)) / interval * 2 * PI / scale) + sin((time + rIndex(inwardsIsRight xor isOutwards, index) * (interval / NUMBER_OF_SEGMENTS)) / interval * 2 * PI / scale) / 2 + 0.5 ) @@ -92,6 +94,42 @@ class StairvilleTlbButItsSplb(override val firstChannel: DmxAddress, val inwards } } + Effect.BUMP_INWARDS -> { + val interval = 350.0 + + Array(NUMBER_OF_SEGMENTS) { index -> + color.multiplyBrightness( + fadeInOut( + (time + rIndex(inwardsIsRight, index) * (interval / NUMBER_OF_SEGMENTS)).mod(interval).roundToLong(), + rampUpDuration = 0, + sustainDuration = 0, + rampDownDuration = (interval * 0.75).roundToLong(), + ) + ) + } + } + + Effect.CHASE_BACK_AND_FORTH -> { + val interval = 350 + val fullInterval = interval * 2 + val isMovingNegative = time.mod(fullInterval) < interval + val frontIndex = (if (isMovingNegative) time.mod(interval) else interval - time.mod(interval)) / interval.toDouble() * NUMBER_OF_SEGMENTS + + Array(NUMBER_OF_SEGMENTS) { index -> + val t = fullInterval + if (isMovingNegative) ((index - frontIndex) * (interval.toDouble() / NUMBER_OF_SEGMENTS)) + else ((frontIndex - index) * (interval.toDouble() / NUMBER_OF_SEGMENTS)) + + color.multiplyBrightness( + fadeInOut( + t.roundToLong(), + rampUpDuration = 0, + sustainDuration = 0, + rampDownDuration = (interval * (3 / 8.0)).roundToLong(), + ) + ) + } + } + else -> TODO() } } diff --git a/src/main/kotlin/de/moritzruth/dracula_musical/song/Mittsommernacht.kt b/src/main/kotlin/de/moritzruth/dracula_musical/song/Mittsommernacht.kt index 4cde485..ffe4fbe 100644 --- a/src/main/kotlin/de/moritzruth/dracula_musical/song/Mittsommernacht.kt +++ b/src/main/kotlin/de/moritzruth/dracula_musical/song/Mittsommernacht.kt @@ -180,7 +180,7 @@ fun SceneBuilderContext.songMittsommernacht() { BlinderBars.all { it.color.reset() it.brightness.fade(25.percent, 1.seconds) - it.effect.static(StairvilleSplb.Effect.CHASE_INWARDS) + it.effect.static(StairvilleSplb.Effect.BUMP_INWARDS) it.effect.speed.static(80.percent) } } diff --git a/src/main/kotlin/de/moritzruth/dracula_musical/song/StreitDerVampire.kt b/src/main/kotlin/de/moritzruth/dracula_musical/song/StreitDerVampire.kt index a4698fc..fecbf32 100644 --- a/src/main/kotlin/de/moritzruth/dracula_musical/song/StreitDerVampire.kt +++ b/src/main/kotlin/de/moritzruth/dracula_musical/song/StreitDerVampire.kt @@ -12,7 +12,7 @@ import kotlin.time.Duration.Companion.seconds fun SceneBuilderContext.songStreitDerVampire() { lightStep(StepCue.MusicStart("Streit der Vampire", 1.minutes + 40.seconds)) { BlinderBars.all { - it.effect.static(StairvilleSplb.Effect.CHASE_INWARDS) + it.effect.static(StairvilleSplb.Effect.BUMP_INWARDS) it.effect.speed.static(40.percent) it.brightness.fade(25.percent, 1.seconds) }