[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

@@ -8,6 +8,18 @@ import org.openrndr.extra.shadestyles.fills.FillUnits
import org.openrndr.extra.shadestyles.fills.SpreadMethod
import org.openrndr.extra.shadestyles.fills.gradients.gradient
/**
* An application with two animated layers of slightly different stellar shade styles.
*
* The bottom layer features a rectangle, while the top layer includes a large text
* repeated 5 times.
*
* The only different between the two shade styles is a minor change in the `levelWarp`
* function, which is used to alter the gradient's level (its normalized `t` value)
* based on the current coordinates being processed, and the original level at this location.
*
* Without this difference, the shader would look identical, and the text would be invisible.
*/
fun main() {
application {
configure {
@@ -24,18 +36,22 @@ fun main() {
quantization = 10
fillUnits = FillUnits.WORLD
spreadMethod = SpreadMethod.REFLECT
levelWarpFunction = """float levelWarp(vec2 p, float level) { return level + cos(p.x*0.01 + level)*0.1; } """
levelWarpFunction = """
float levelWarp(vec2 p, float level) {
return level + cos(p.x * 0.01 + level) * 0.1;
}
""".trimIndent()
stellar {
radius = drawer.bounds.width/4.0
radius = drawer.bounds.width / 4.0
center = drawer.bounds.position(0.5, 0.0)
sides = 6
sharpness = 0.5
rotation = seconds * 36.0
}
}
drawer.rectangle(drawer.bounds)
drawer.shadeStyle = gradient<ColorRGBa> {
stops[0.0] = ColorRGBa.BLUE_STEEL
stops[0.75] = ColorRGBa.WHITE
@@ -44,10 +60,14 @@ fun main() {
quantization = 10
fillUnits = FillUnits.WORLD
spreadMethod = SpreadMethod.REFLECT
levelWarpFunction = """float levelWarp(vec2 p, float level) { return level + 0.1 + cos(p.x*0.01 + level)*0.1; } """
levelWarpFunction = """
float levelWarp(vec2 p, float level) {
return level + 0.1 + cos(p.x * 0.01 + level) * 0.1;
}
""".trimIndent()
stellar {
radius = drawer.bounds.width/4.0
radius = drawer.bounds.width / 4.0
center = drawer.bounds.position(0.5, 0.0)
sides = 6
sharpness = 0.5