[orx-shade-styles] Write comments on demos
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user