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:
@@ -4,41 +4,39 @@ import org.openrndr.draw.isolated
|
||||
import org.openrndr.shape.Circle
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
|
||||
program {
|
||||
val cs = Rectangle(0.0, 0.0, 200.0, 200.0).contour
|
||||
val cc = Circle(100.0, 0.0, 100.0).contour
|
||||
program {
|
||||
val cs = Rectangle(0.0, 0.0, 200.0, 200.0).contour
|
||||
val cc = Circle(100.0, 0.0, 100.0).contour
|
||||
|
||||
extend {
|
||||
drawer.fill = ColorRGBa.GRAY
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
drawer.isolated {
|
||||
drawer.contour(cs)
|
||||
drawer.translate(300.0, 0.0)
|
||||
extend {
|
||||
drawer.fill = ColorRGBa.GRAY
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
drawer.isolated {
|
||||
drawer.contour(cs)
|
||||
drawer.translate(300.0, 0.0)
|
||||
|
||||
// this should create a contour similar to the input contour
|
||||
drawer.contour(cs.sampleEquidistant(4))
|
||||
drawer.contour(cs.sampleEquidistant(3))
|
||||
}
|
||||
// this should create a contour similar to the input contour
|
||||
drawer.contour(cs.sampleEquidistant(4))
|
||||
drawer.contour(cs.sampleEquidistant(3))
|
||||
}
|
||||
|
||||
drawer.isolated {
|
||||
drawer.translate(.0, 400.0)
|
||||
drawer.contour(cc)
|
||||
drawer.translate(300.0, 0.0)
|
||||
drawer.isolated {
|
||||
drawer.translate(.0, 400.0)
|
||||
drawer.contour(cc)
|
||||
drawer.translate(300.0, 0.0)
|
||||
|
||||
drawer.contour(cc)
|
||||
// this should draw a hexagon
|
||||
drawer.contour(cc.sampleEquidistant(6))
|
||||
// this should draw a triangle
|
||||
drawer.contour(cc.sampleEquidistant(3))
|
||||
}
|
||||
drawer.contour(cc)
|
||||
// this should draw a hexagon
|
||||
drawer.contour(cc.sampleEquidistant(6))
|
||||
// this should draw a triangle
|
||||
drawer.contour(cc.sampleEquidistant(3))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,42 +13,40 @@ import org.openrndr.shape.Triangle
|
||||
* a 3x3 grid of triangles and lines.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
|
||||
program {
|
||||
val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 20.0)
|
||||
val pointA = Vector2(0.0, 50.0)
|
||||
val pointB = Vector2(50.0, -20.0)
|
||||
val pointC = Vector2(-50.0, 0.0)
|
||||
val triangle = Triangle(pointA, pointB, pointC).contour
|
||||
program {
|
||||
val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 20.0)
|
||||
val pointA = Vector2(0.0, 50.0)
|
||||
val pointB = Vector2(50.0, -20.0)
|
||||
val pointC = Vector2(-50.0, 0.0)
|
||||
val triangle = Triangle(pointA, pointB, pointC).contour
|
||||
|
||||
extend {
|
||||
drawer.apply {
|
||||
fill = ColorRGBa.GRAY
|
||||
stroke = ColorRGBa.PINK
|
||||
strokeWeight = 8.0
|
||||
fontMap = font
|
||||
LineCap.entries.forEachIndexed { x, cap ->
|
||||
lineCap = cap
|
||||
LineJoin.entries.forEachIndexed { y, join ->
|
||||
lineJoin = join
|
||||
val pos = IntVector2(x - 1, y - 1).vector2 * 180.0
|
||||
isolated {
|
||||
translate(bounds.position(0.46, 0.46) + pos)
|
||||
text("cap: ${cap.name}", -30.5, 80.5)
|
||||
text("join: ${join.name}", -30.5, 100.5)
|
||||
contour(triangle)
|
||||
lineSegment(pointA - pointC, pointB - pointC)
|
||||
}
|
||||
extend {
|
||||
drawer.apply {
|
||||
fill = ColorRGBa.GRAY
|
||||
stroke = ColorRGBa.PINK
|
||||
strokeWeight = 8.0
|
||||
fontMap = font
|
||||
LineCap.entries.forEachIndexed { x, cap ->
|
||||
lineCap = cap
|
||||
LineJoin.entries.forEachIndexed { y, join ->
|
||||
lineJoin = join
|
||||
val pos = IntVector2(x - 1, y - 1).vector2 * 180.0
|
||||
isolated {
|
||||
translate(bounds.position(0.46, 0.46) + pos)
|
||||
text("cap: ${cap.name}", -30.5, 80.5)
|
||||
text("join: ${join.name}", -30.5, 100.5)
|
||||
contour(triangle)
|
||||
lineSegment(pointA - pointC, pointB - pointC)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user