[orx-noise] Tidy up demos
Produce 720px wide images.
Use main() = application { for reduced indentation
This commit is contained in:
30
orx-noise/src/jvmDemo/kotlin/hash/DemoCircleHash01.kt
Normal file
30
orx-noise/src/jvmDemo/kotlin/hash/DemoCircleHash01.kt
Normal file
@@ -0,0 +1,30 @@
|
||||
package hash
|
||||
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.noise.shapes.hash
|
||||
import org.openrndr.extra.noise.shapes.uniform
|
||||
import org.openrndr.shape.Circle
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 360
|
||||
}
|
||||
program {
|
||||
extend {
|
||||
val b = drawer.bounds
|
||||
val b0 = b.sub(0.0, 0.0, 0.5, 1.0).offsetEdges(-10.0)
|
||||
val b1 = b.sub(0.5, 0.0, 1.0, 1.0).offsetEdges(-10.0)
|
||||
|
||||
val c0 = Circle(b0.center, b0.width / 2.0)
|
||||
val c1 = Circle(b1.center, b1.width / 2.0)
|
||||
|
||||
val r = Random(0)
|
||||
for (i in 0 until 2000) {
|
||||
drawer.circle(c0.uniform(r), 2.0)
|
||||
drawer.circle(c1.hash(909, i), 2.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
orx-noise/src/jvmDemo/kotlin/hash/DemoRectangleHash01.kt
Normal file
27
orx-noise/src/jvmDemo/kotlin/hash/DemoRectangleHash01.kt
Normal file
@@ -0,0 +1,27 @@
|
||||
package hash
|
||||
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.noise.shapes.hash
|
||||
import org.openrndr.extra.noise.shapes.uniform
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 540
|
||||
}
|
||||
program {
|
||||
extend {
|
||||
val b = drawer.bounds
|
||||
val b0 = b.sub(0.0, 0.0, 0.5, 1.0).offsetEdges(-10.0)
|
||||
val b1 = b.sub(0.5, 0.0, 1.0, 1.0).offsetEdges(-10.0)
|
||||
|
||||
val r = Random(0)
|
||||
for (i in 0 until 20000) {
|
||||
drawer.circle(b0.uniform(r), 2.0)
|
||||
drawer.circle(b1.hash(909, i), 2.0)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
orx-noise/src/jvmDemo/kotlin/hash/DemoUHash01.kt
Normal file
26
orx-noise/src/jvmDemo/kotlin/hash/DemoUHash01.kt
Normal file
@@ -0,0 +1,26 @@
|
||||
package hash
|
||||
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.noise.fhash3D
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 360
|
||||
}
|
||||
program {
|
||||
extend {
|
||||
drawer.points {
|
||||
for (y in 0 until height) {
|
||||
for (x in 0 until width) {
|
||||
val c = fhash3D(100, x + (seconds * 60.0).toInt(), y, (0).toInt())
|
||||
//val u = uhash11(x.toUInt()).toDouble() / UInt.MAX_VALUE.toDouble()
|
||||
fill = ColorRGBa(c, c, c, 1.0)
|
||||
point(x.toDouble(), y.toDouble())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user