Skip to content

Commit

Permalink
[orx-jumpflood] fix demo in/out detection
Browse files Browse the repository at this point in the history
  • Loading branch information
hamoid committed Nov 1, 2024
1 parent 6b89b46 commit 82650b8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions orx-jumpflood/src/jvmDemo/kotlin/DemoDistanceField01.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ import org.openrndr.shape.Rectangle

/**
* Shows how to use the [DistanceField] filter.
*
* Draws moving white shapes on black background,
* then applies the DistanceField filter which returns a [ColorBuffer] in which
* the red component encodes the distance to the closest black/white edge.
* The value is positive when on the black background and negative
* when inside white shapes. The sign is used in the [shadeStyle] to choose
* between two colors. The inverse of the distance is used to obtain a
* non-linear brightness.
*
* The value of the green component is negative when on the black background
* and positive when inside white shapes. The sign is used in the [shadeStyle] to choose
* between two colors.
*
* The inverse of the distance is used to obtain a non-linear brightness.
*
* Hold down a mouse button to see the raw animation.
*/
fun main() = application {
Expand All @@ -39,8 +43,7 @@ fun main() = application {
// wavy effect
// bri *= (1.0 + 0.2 * sin(distance * 0.2));
x_fill.rgb = bri * (x_fill.r > 0 ?
vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 1.0));
x_fill.rgb = bri * (x_fill.g > 0.0 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 1.0));
"""
}
val mouseTracker = MouseTracker(mouse)
Expand Down

0 comments on commit 82650b8

Please sign in to comment.