Bump to OPENRNDR 0.3.44-rc.6, add demos

This commit is contained in:
Edwin Jakobs
2020-07-26 12:15:40 +02:00
parent 94e52367e4
commit fe979f5a75
3 changed files with 53 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
// Converting Catmull-Rom curves to Bezier
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.math.CatmullRomChain2
import org.openrndr.math.Polar
import org.openrndr.shape.ShapeContour
import org.openrndr.shape.toContour
fun main() = application {
program {
val points = List(6) { Polar(it * 70.0, 100.0).cartesian + drawer.bounds.center }
val cmr = CatmullRomChain2(points, 1.0, loop = true)
val contour = ShapeContour.fromPoints(cmr.positions(200), true)
extend {
drawer.run {
clear(ColorRGBa.WHITE)
fill = null
stroke = ColorRGBa.BLACK
contour(contour)
circles(points, 5.0)
stroke = ColorRGBa.RED
contour(cmr.toContour())
fill = ColorRGBa.BLACK
}
}
}
}

View File

@@ -0,0 +1,22 @@
// Drawing points using a stored batch
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.pointBatch
fun main() = application {
program {
val storedBatch = drawer.pointBatch {
for (y in 10 until height step 20) {
for (x in 10 until width step 20) {
fill = ColorRGBa.PINK.shade(Math.random())
point(x * 1.0, y * 1.0)
}
}
}
extend {
drawer.clear(ColorRGBa.GRAY)
drawer.points(storedBatch)
}
}
}