[orx-shapes, orx-mesh-generator] Move frames code from orx-mesh-generator to orx-shapes

This commit is contained in:
Edwin Jakobs
2024-03-19 17:54:03 +01:00
parent 76f96d2278
commit c48aa83ced
10 changed files with 167 additions and 23 deletions

View File

@@ -0,0 +1,44 @@
package arrangement
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.color.rgb
import org.openrndr.extra.color.spaces.OKHSV
import org.openrndr.extra.color.tools.saturate
import org.openrndr.extra.noise.uniform
import org.openrndr.extra.shapes.arrangement.Arrangement
import org.openrndr.math.Vector2
import org.openrndr.shape.Circle
import kotlin.math.sqrt
import kotlin.random.Random
fun main() {
application {
program {
val circles = listOf(
Circle(drawer.bounds.center -Vector2(50.0, 0.0), 50.0),
Circle(drawer.bounds.center + Vector2(50.0, 0.0), 50.0),
Circle(drawer.bounds.center + Vector2(0.0, 50.0), 50.0),
Circle(drawer.bounds.center - Vector2(0.0, 50.0), 50.0),
Circle(drawer.bounds.center -Vector2(50.0, 0.0), sqrt(50.0*50.0+50.0*50.0)-49.9),
Circle(drawer.bounds.center +Vector2(50.0, 0.0), sqrt(50.0*50.0+50.0*50.0)-49.9),
Circle(drawer.bounds.center -Vector2(0.0, 50.0), sqrt(50.0*50.0+50.0*50.0)-49.9),
Circle(drawer.bounds.center +Vector2(0.0, 50.0), sqrt(50.0*50.0+50.0*50.0)-49.9),
).shuffled()
val arr = Arrangement(circles)
extend {
val r = Random(100)
drawer.stroke = ColorRGBa.WHITE
for (f in arr.boundedFaces) {
drawer.fill =
rgb(Double.uniform(0.0, 1.0, r), Double.uniform(0.0, 1.0, r), Double.uniform(0.0, 1.0, r)).saturate<OKHSV>(0.25)
drawer.contour(f.contour)
}
}
}
}
}