[orx-shade-styles] Write comments on demos

This commit is contained in:
Abe Pazos
2025-09-20 19:07:38 +02:00
parent ec9ec947a6
commit ec4032c452
29 changed files with 298 additions and 61 deletions

View File

@@ -10,6 +10,17 @@ import org.openrndr.extra.imageFit.imageFit
import org.openrndr.extra.shadestyles.fills.FillUnits
import org.openrndr.extra.shadestyles.fills.patterns.pattern
/**
* Demonstrates the use of the `checkers` variant of the `pattern` shade style.
*
* The style is used twice with different parameters: once for a background image
* and then for a text displayed on top of it.
*
* The text shade style features a `domainWarpFunction`, which is used to deform
* the coordinate system of the shade style.
*
* Try reducing the `scale` parameter to make the checkers more obvious.
*/
fun main() = application {
configure {
width = 720
@@ -23,7 +34,7 @@ fun main() = application {
backgroundColor = ColorRGBa.NAVY
foregroundColor = ColorRGBa.WHITE
patternUnits = FillUnits.WORLD
parameter("time", seconds*0.1)
parameter("time", seconds * 0.1)
// domainWarpFunction = """vec2 patternDomainWarp(vec2 uv) { return uv + vec2(cos(uv.y * 0.1 + p_time), sin(uv.x * 0.1 + p_time)) * 30.05; }"""
scale = 0.4
@@ -39,7 +50,8 @@ fun main() = application {
foregroundColor = ColorRGBa.WHITE
patternUnits = FillUnits.WORLD
parameter("time", seconds)
domainWarpFunction = """vec2 patternDomainWarp(vec2 uv) { return uv + vec2(cos(uv.y * 0.1 + p_time), sin(uv.x * 0.1 + p_time)) * 30.05; }"""
domainWarpFunction =
"""vec2 patternDomainWarp(vec2 uv) { return uv + vec2(cos(uv.y * 0.1 + p_time), sin(uv.x * 0.1 + p_time)) * 30.05; }"""
scale = 0.2
checkers {
}

View File

@@ -8,6 +8,10 @@ import org.openrndr.extra.color.presets.PEACH_PUFF
import org.openrndr.extra.shadestyles.fills.FillUnits
import org.openrndr.extra.shadestyles.fills.patterns.pattern
/**
* Demonstrates the use of the `xorMod2` variant of the `pattern` shade style;
* an algorithmic and intricate pattern.
*/
fun main() = application {
configure {
width = 720

View File

@@ -11,6 +11,10 @@ import org.openrndr.extra.shadestyles.fills.gradients.gradient
import org.openrndr.extra.shadestyles.fills.patterns.pattern
import kotlin.math.cos
/**
* Demonstrates the use of a complex shade style made by combining an
* animated `pattern`, a `gradient` and a `clip`.
*/
fun main() = application {
configure {
width = 720
@@ -23,7 +27,7 @@ fun main() = application {
backgroundColor = ColorRGBa.DARK_GRAY
foregroundColor = ColorRGBa.PEACH_PUFF
patternUnits = FillUnits.WORLD
parameter("time", seconds*0.1)
parameter("time", seconds * 0.1)
scale = 0.2
crosses {
width = 1.0
@@ -35,7 +39,7 @@ fun main() = application {
stops[1.0] = ColorRGBa.BLACK
stops[0.5] = ColorRGBa.WHITE
stops[0.0] = ColorRGBa.WHITE
conic { }
conic { }
} + clip {
star {
sides = 36
@@ -53,7 +57,6 @@ fun main() = application {
// drawer.text("Patterns", 10.0, height / 2.0)
}
}
}