INNER CODE UNIT · Kotlin
blinkWithColorInput
fjossinet/RNArtist · src/main/kotlin/RNArtist.kt:163
private fun blinkWithColorInput(node: Node) {
val colorChange = SimpleObjectProperty<Color?>(null)
colorChange.addListener { _, _, newValue ->
newValue?.let {
val effect = ColorInput()
effect.paint = newValue
node.effect = effect
} ?: run {
node.effect = null
}
}
val blink = Timeline()
blink.cycleCount = 2
blink.keyFrames.add(KeyFrame(Duration.seconds(0.2), KeyValue(colorChange, Color.DARKORANGE)))
blink.keyFrames.add(KeyFrame(Duration.seconds(0.4), KeyValue(colorChange, null)))
blink.keyFrames.add(KeyFrame(Duration.seconds(0.6), KeyValue(colorChange, Color.DARKORANGE)))
blink.keyFrames.add(KeyFrame(Duration.seconds(0.8), KeyValue(colorChange, null)))