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:
@@ -6,35 +6,37 @@ import org.openrndr.shape.Circle
|
||||
import kotlin.random.Random
|
||||
|
||||
/**
|
||||
* Demonstrate using a multi color radial gradient.
|
||||
* Demonstrate using a multicolor radial gradient.
|
||||
* The gradient has 5 colors (first and last ones are transparent).
|
||||
* Any of the properties can be animated, including colors and points.
|
||||
* See DemoNPointLinearGradient01.kt for an example of animated properties.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
program {
|
||||
val gradient = NPointRadialGradient(arrayOf(
|
||||
ColorRGBa.PINK.opacify(0.0),
|
||||
ColorRGBa.PINK, ColorRGBa.WHITE, ColorRGBa.PINK,
|
||||
ColorRGBa.PINK.opacify(0.0)
|
||||
), arrayOf(0.0, 0.4, 0.5, 0.6, 1.0))
|
||||
fun main() = application {
|
||||
program {
|
||||
val gradient = NPointRadialGradient(
|
||||
arrayOf(
|
||||
ColorRGBa.PINK.opacify(0.0),
|
||||
ColorRGBa.PINK, ColorRGBa.WHITE, ColorRGBa.PINK,
|
||||
ColorRGBa.PINK.opacify(0.0)
|
||||
), arrayOf(0.0, 0.4, 0.5, 0.6, 1.0)
|
||||
)
|
||||
|
||||
val circles = List(25) {
|
||||
Circle(Random.nextDouble() * drawer.width,
|
||||
Random.nextDouble() * drawer.height,
|
||||
Random.nextDouble() * 150.0)
|
||||
}
|
||||
val circles = List(25) {
|
||||
Circle(
|
||||
Random.nextDouble() * drawer.width,
|
||||
Random.nextDouble() * drawer.height,
|
||||
Random.nextDouble() * 150.0
|
||||
)
|
||||
}
|
||||
|
||||
extend {
|
||||
drawer.run {
|
||||
clear(rgb(0.2))
|
||||
shadeStyle = gradient
|
||||
fill = ColorRGBa.WHITE
|
||||
stroke = null
|
||||
circles(circles)
|
||||
}
|
||||
extend {
|
||||
drawer.run {
|
||||
clear(rgb(0.2))
|
||||
shadeStyle = gradient
|
||||
fill = ColorRGBa.WHITE
|
||||
stroke = null
|
||||
circles(circles)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user