Demos: ensure all use fun main() = application {

- Adjust some demo window sizes.
- Replace Random.double by Double.uniform
- Tweak some demos so screenshots look more interesting
This commit is contained in:
Abe Pazos
2025-01-26 20:57:04 +01:00
parent 1975a820fc
commit c8f7dd52c6
116 changed files with 2889 additions and 2942 deletions

View File

@@ -201,38 +201,36 @@ import org.openrndr.extra.fx.edges.EdgesWork
import org.openrndr.extra.gui.GUI
import org.openrndr.math.Vector2
fun main() {
application {
configure {
width = 768
height = 768
}
program {
val w2 = width / 2.0
val h2 = height / 2.0
fun main() = application {
configure {
width = 768
height = 768
}
program {
val w2 = width / 2.0
val h2 = height / 2.0
val c = compose {
draw {
drawer.fill = ColorRGBa.PINK
drawer.circle(width / 2.0, height / 2.0, 10.0)
}
layer {
blend(Add())
val c = compose {
draw {
drawer.fill = ColorRGBa.PINK
drawer.circle(width / 2.0, height / 2.0, 10.0)
drawer.circle(width / 2.0, height / 2.0, 100.0)
}
layer {
blend(Add())
draw {
drawer.circle(width / 2.0, height / 2.0, 100.0)
}
post(ApproximateGaussianBlur()) {
window = 10
sigma = Math.cos(seconds * 10.0) * 10.0 + 10.0
}
post(ApproximateGaussianBlur()) {
window = 10
sigma = Math.cos(seconds * 10.0) * 10.0 + 10.0
}
}
extend(gui)
extend {
c.draw(drawer)
}
}
extend(gui)
extend {
c.draw(drawer)
}
}
}

View File

@@ -6,29 +6,31 @@ import org.openrndr.extra.fx.blur.HashBlurDynamic
import org.openrndr.extra.fx.patterns.Checkers
import kotlin.math.cos
fun main() {
application {
program {
val c = compose {
layer {
val a = aside(colorType = ColorType.FLOAT32) {
post(Checkers()) {
this.size = cos(seconds)*0.5 + 0.5
}
}
draw {
drawer.clear(ColorRGBa.GRAY.shade(0.5))
drawer.circle(width/2.0, height/2.0, 100.0)
}
post(HashBlurDynamic(), a) {
time = seconds
radius = 25.0
fun main() = application {
configure {
width = 720
height = 720
}
program {
val c = compose {
layer {
val a = aside(colorType = ColorType.FLOAT32) {
post(Checkers()) {
this.size = cos(seconds + 2.0) * 0.5 + 0.5
}
}
}
extend {
c.draw(drawer)
draw {
drawer.clear(ColorRGBa.GRAY.shade(0.5))
drawer.circle(width / 2.0, height / 2.0, 100.0)
}
post(HashBlurDynamic(), a) {
time = seconds
radius = 25.0
}
}
}
extend {
c.draw(drawer)
}
}
}
}

View File

@@ -17,8 +17,8 @@ import kotlin.random.Random
*/
fun main() = application {
configure {
width = 900
height = 900
width = 720
height = 720
}
program {

View File

@@ -14,10 +14,9 @@ import org.openrndr.shape.Rectangle
* Try changing which layer has multisampling applied and observe the results.
*/
fun main() = application {
System.setProperty("org.openrndr.gl3.debug", "true")
configure {
width = 800
height = 800
width = 720
height = 720
}
program {
@@ -25,17 +24,17 @@ fun main() = application {
layer(multisample = BufferMultisample.SampleCount(4)) {
draw {
drawer.translate(drawer.bounds.center)
drawer.rotate(seconds)
drawer.rotate(seconds + 5)
drawer.fill = ColorRGBa.PINK
drawer.rectangle(Rectangle.fromCenter(Vector2.ZERO, 200.0))
}
layer {
layer() {
blend(Normal()) {
clip = true
}
draw {
drawer.rotate(seconds * -2)
drawer.rotate((seconds + 5) * -2)
drawer.fill = ColorRGBa.WHITE
drawer.rectangle(Rectangle.fromCenter(Vector2.ZERO, 200.0))
}