[orx-shapes] Comment the ContourAdjuster and its demos

This commit is contained in:
Abe Pazos
2025-08-29 13:00:27 +02:00
parent c531c45608
commit 2e6c637b49
9 changed files with 248 additions and 33 deletions

View File

@@ -7,6 +7,15 @@ import org.openrndr.math.Vector2
import org.openrndr.shape.contour
import kotlin.math.cos
/**
* Demonstrates how to create and manipulate a contour dynamically using the `adjustContour` function.
*
* The program initializes a simple linear contour and applies transformations to it on each animation frame:
* - The only edge of the contour is split into many equal parts.
* - A value between 0 and 1 is calculated based on the cosine of the current time in seconds.
* - That value is used to calculate an anchor point and to select all vertices to its right
* - The selected vertices are rotated around an anchor, as if rolling a straight line into a spiral.
*/
fun main() = application {
configure {
width = 800
@@ -22,7 +31,7 @@ fun main() = application {
contour = adjustContour(contour) {
selectEdge(0)
edge.splitIn(128)
val tr = cos(seconds) * 0.5 + 0.5
val tr = cos(seconds + 2.0) * 0.5 + 0.5
selectVertices { i, v -> v.t >= tr }
val anchor = contour.position(tr)