[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,14 @@ import org.openrndr.extra.shadestyles.fills.gradients.gradient
import org.openrndr.extra.shapes.primitives.grid
import org.openrndr.math.Vector2
/**
* A design with 48 vertical bands with gradients. Each one has a unique `quantization`
* value based on the index of the band. All bands have 2 color `stops`:
* `WHITE` at the top (position 0.0), and `BLACK` near the bottom (near position 1.0),
* with the exact value depending on the `quantization` value.
*
* Demonstrates how to produce a quantized gradient with a specific number of equal color bands.
*/
fun main() = application {
configure {
width = 720
@@ -25,7 +33,7 @@ fun main() = application {
drawer.shadeStyle = gradient<ColorRGBa> {
quantization = index + 2
stops[0.0] = ColorRGBa.WHITE
stops[ (quantization) / (quantization+1.0)] = ColorRGBa.BLACK
stops[(quantization) / (quantization + 1.0)] = ColorRGBa.BLACK
fillUnits = FillUnits.BOUNDS
fillFit = FillFit.COVER