[orx-fx] Correct BlendSpectral

This commit is contained in:
Edwin Jakobs
2023-12-15 01:03:34 +01:00
parent d2cd12a0b0
commit 39055254c6
2 changed files with 24 additions and 14 deletions

View File

@@ -3,6 +3,7 @@ import org.openrndr.color.ColorRGBa
import org.openrndr.draw.createEquivalent
import org.openrndr.drawImage
import org.openrndr.extra.fx.blend.BlendSpectral
import org.openrndr.extra.fx.blur.BoxBlur
import org.openrndr.extra.fx.patterns.Checkers
import org.openrndr.math.Vector2
import kotlin.math.sin
@@ -17,7 +18,7 @@ fun main() {
val a = drawImage(width, height) {
drawer.stroke = null
drawer.fill = ColorRGBa.BLUE
drawer.circle(drawer.bounds.center - Vector2(100.0, 0.0) , drawer.width * 0.25)
drawer.circle(drawer.bounds.center - Vector2(100.0, 0.0), drawer.width * 0.25)
}
val b = drawImage(width, height) {
drawer.clear(ColorRGBa.TRANSPARENT)
@@ -26,7 +27,7 @@ fun main() {
drawer.fill = ColorRGBa.YELLOW.opacify(1.0)
drawer.circle(drawer.bounds.center + Vector2(100.0, 0.0), drawer.width * 0.25)
}
BoxBlur().apply { window = 10 }.apply(b, b)
val checked = a.createEquivalent()
Checkers().apply(emptyArray(), checked)
@@ -35,6 +36,7 @@ fun main() {
extend {
drawer.image(checked)
blendSpectral.fill = sin(seconds) * 0.5 + 0.5
blendSpectral.clip = seconds.mod(4.0) > 2.0
blendSpectral.apply(a, b, mixed)
drawer.image(mixed)
}