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,8 +4,7 @@ import org.openrndr.draw.isolated
|
||||
import org.openrndr.shape.Circle
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -40,5 +39,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,7 @@ import org.openrndr.shape.Triangle
|
||||
* a 3x3 grid of triangles and lines.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -50,5 +49,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,10 @@ import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.composition.composition
|
||||
import org.openrndr.extra.composition.drawComposition
|
||||
import org.openrndr.extra.svg.saveToFile
|
||||
import org.openrndr.extra.svg.toSVG
|
||||
import org.openrndr.math.Vector2
|
||||
import java.io.File
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val composition = drawComposition {
|
||||
val layer = group {
|
||||
@@ -38,5 +35,4 @@ fun main() {
|
||||
drawer.composition(composition)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,7 @@ import org.openrndr.extra.composition.ClipMode
|
||||
import org.openrndr.extra.composition.composition
|
||||
import org.openrndr.extra.composition.drawComposition
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val cd = drawComposition {
|
||||
fill = null
|
||||
@@ -22,5 +21,4 @@ fun main() {
|
||||
drawer.composition(cd)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,25 +4,22 @@ import org.openrndr.extra.composition.ClipMode
|
||||
import org.openrndr.extra.composition.composition
|
||||
import org.openrndr.extra.composition.drawComposition
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val cd = drawComposition {
|
||||
fill = null
|
||||
clipMode = ClipMode.REVERSE_DIFFERENCE
|
||||
|
||||
circle(width / 2.0-50.0, height / 2.0, 100.0)
|
||||
circle(width / 2.0+50.0, height / 2.0, 100.0)
|
||||
circle(width / 2.0 - 50.0, height / 2.0, 100.0)
|
||||
circle(width / 2.0 + 50.0, height / 2.0, 100.0)
|
||||
|
||||
fill = ColorRGBa.BLACK
|
||||
circle(width / 2.0, height / 2.0, 100.0)
|
||||
}
|
||||
|
||||
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
drawer.composition(cd)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,8 +201,7 @@ import org.openrndr.extra.fx.edges.EdgesWork
|
||||
import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.math.Vector2
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 768
|
||||
height = 768
|
||||
@@ -234,7 +233,6 @@ fun main() {
|
||||
c.draw(drawer)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
<!-- __demos__ -->
|
||||
|
||||
@@ -6,19 +6,22 @@ import org.openrndr.extra.fx.blur.HashBlurDynamic
|
||||
import org.openrndr.extra.fx.patterns.Checkers
|
||||
import kotlin.math.cos
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
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)*0.5 + 0.5
|
||||
this.size = cos(seconds + 2.0) * 0.5 + 0.5
|
||||
}
|
||||
}
|
||||
draw {
|
||||
drawer.clear(ColorRGBa.GRAY.shade(0.5))
|
||||
drawer.circle(width/2.0, height/2.0, 100.0)
|
||||
drawer.circle(width / 2.0, height / 2.0, 100.0)
|
||||
}
|
||||
post(HashBlurDynamic(), a) {
|
||||
time = seconds
|
||||
@@ -30,5 +33,4 @@ fun main() {
|
||||
c.draw(drawer)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,8 @@ import kotlin.random.Random
|
||||
*/
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 900
|
||||
height = 900
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
|
||||
program {
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@ import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.math.Vector2
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val gui = GUI()
|
||||
|
||||
@@ -36,5 +35,4 @@ fun main() {
|
||||
drawer.lineSegment(drawer.bounds.center, drawer.bounds.center + Vector2(state.differenceMax, 0.0))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,7 @@ import org.openrndr.math.map
|
||||
* [grid] is used to layout graphs on rows and columns.
|
||||
*
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 1080
|
||||
@@ -27,7 +26,7 @@ fun main() {
|
||||
).flatten()
|
||||
|
||||
// make pairs of (easing function, grid rectangle)
|
||||
val pairs = Easing.values() zip grid
|
||||
val pairs = Easing.entries.toTypedArray() zip grid
|
||||
|
||||
extend {
|
||||
// ~4 seconds animation loop
|
||||
@@ -76,5 +75,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,7 @@ import org.openrndr.application
|
||||
import org.openrndr.draw.loadFont
|
||||
import org.openrndr.extra.envelopes.ADSRTracker
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val tracker = ADSRTracker(this)
|
||||
tracker.attack = 1.0
|
||||
@@ -31,5 +30,4 @@ fun main() {
|
||||
drawer.text("press and hold 't'", 20.0, height - 20.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,7 @@ import org.openrndr.extra.envelopes.ADSRTracker
|
||||
import org.openrndr.extra.noise.shapes.uniform
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val tracker = ADSRTracker(this)
|
||||
tracker.attack = 1.0
|
||||
@@ -42,5 +41,4 @@ fun main() {
|
||||
drawer.text("press and hold 't' and/or 'r'", 20.0, height - 20.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,7 @@ import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.extra.gui.addTo
|
||||
import org.openrndr.extra.parameters.TextParameter
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val gui = GUI()
|
||||
gui.compartmentsCollapsedByDefault = false
|
||||
@@ -42,5 +41,4 @@ fun main() {
|
||||
drawer.circle(x, y, radius)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ import org.openrndr.extra.parameters.TextParameter
|
||||
* Improved version of DemoExpressionEvaluator01, it uses [watchingExpression1] to automatically convert an expression
|
||||
* string into a function with a parameter "t".
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val gui = GUI()
|
||||
gui.compartmentsCollapsedByDefault = false
|
||||
@@ -40,5 +39,4 @@ fun main() {
|
||||
drawer.circle(x, y, radius)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,8 +118,7 @@ Drawing FCurves is useful for debugging, but their typical use is for animation.
|
||||
The FCurve sampler allows us to query values for the given time value like this:
|
||||
|
||||
```kotlin
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val xCurve = fcurve(
|
||||
"""
|
||||
@@ -129,17 +128,17 @@ fun main() {
|
||||
S2,0, 2,320
|
||||
S2,0, 2,320
|
||||
T0.6,320
|
||||
""".trimIndent()
|
||||
).sampler() // <--
|
||||
"""
|
||||
)
|
||||
val xCurveSampler = xCurve.sampler()
|
||||
extend {
|
||||
drawer.circle(
|
||||
xCurve(seconds % 9.0),
|
||||
height * 0.5,
|
||||
xCurveSampler(seconds % 9.0),
|
||||
240.0,
|
||||
20.0
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -194,6 +193,7 @@ For example `(M0 (h1 m1)[3])[2]` expands to `M0 h1 m1 h1 m1 h1 m1 M0 h1 m1 h1 m1
|
||||
|
||||
|
||||
# References
|
||||
|
||||
* https://x.com/ruby0x1/status/1258252352672247814
|
||||
* https://blender.stackexchange.com/questions/52403/what-is-the-mathematical-basis-for-f-curves/52468#52468
|
||||
* https://pomax.github.io/bezierinfo/#yforx
|
||||
@@ -210,6 +210,11 @@ For example `(M0 (h1 m1)[3])[2]` expands to `M0 h1 m1 h1 m1 h1 m1 M0 h1 m1 h1 m1
|
||||
|
||||

|
||||
|
||||
### DemoFCurve03
|
||||
[source code](src/jvmDemo/kotlin/DemoFCurve03.kt)
|
||||
|
||||

|
||||
|
||||
### DemoFCurveSheet01
|
||||
[source code](src/jvmDemo/kotlin/DemoFCurveSheet01.kt)
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.fcurve.fcurve
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -15,5 +14,4 @@ fun main() {
|
||||
drawer.circle(xpos(seconds.mod(5.0)), ypos(seconds.mod(5.0)), 100.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,7 @@ import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.fcurve.fcurve
|
||||
import org.openrndr.math.Vector2
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -20,9 +19,8 @@ fun main() {
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
drawer.contours(xposCurve.contours(Vector2(720.0 / 5.0, -1.0), Vector2(0.0, height * 1.0)))
|
||||
drawer.contours(yposCurve.contours(Vector2(720.0 / 5.0, -1.0), Vector2(0.0, height * 1.0)))
|
||||
drawer.translate(seconds.mod(5.0)*(720.0/5.0), 0.0)
|
||||
drawer.translate(seconds.mod(5.0) * (720.0 / 5.0), 0.0)
|
||||
drawer.lineSegment(0.0, 0.0, 0.0, 720.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,17 +3,18 @@ import org.openrndr.extra.fcurve.MultiFCurve
|
||||
import org.openrndr.extra.fcurve.fcurve
|
||||
import org.openrndr.extra.fcurve.vector2
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
class XYAnimation : MultiFCurve(mapOf(
|
||||
class XYAnimation : MultiFCurve(
|
||||
mapOf(
|
||||
"x" to fcurve("M0 Q4,360,5,720"),
|
||||
"y" to fcurve("M360 h5")
|
||||
)) {
|
||||
)
|
||||
) {
|
||||
val position = vector2("x", "y")
|
||||
}
|
||||
|
||||
@@ -24,5 +25,4 @@ fun main() {
|
||||
drawer.circle(position(seconds.mod(5.0)), 100.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,15 +9,14 @@ import org.openrndr.math.Vector2
|
||||
import org.openrndr.math.smoothstep
|
||||
import org.openrndr.math.transforms.buildTransform
|
||||
import org.openrndr.shape.LineSegment
|
||||
import kotlin.math.*
|
||||
import kotlin.math.max
|
||||
import kotlin.random.Random
|
||||
|
||||
/**
|
||||
* Demonstration of using FFT to filter a two-dimensional shape. Mouse xy-position is mapped
|
||||
* to lowpass and highpass settings of the filter.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -50,7 +49,9 @@ fun main() {
|
||||
}
|
||||
|
||||
val c = hobbyCurve(
|
||||
drawer.bounds.scatter(40.0, distanceToEdge = 100.0, random = Random(0)),
|
||||
drawer.bounds.scatter(30.0, distanceToEdge = 100.0, random = Random(3)).filter {
|
||||
Random.nextBoolean()
|
||||
},
|
||||
true
|
||||
).transform(buildTransform { translate(-drawer.bounds.center) })
|
||||
|
||||
@@ -79,8 +80,8 @@ fun main() {
|
||||
|
||||
val xpower = fft.magnitudeSum()
|
||||
|
||||
val lpc = mouse.position.x / width
|
||||
val hpc = mouse.position.y / height
|
||||
val hpc = mouse.position.x / width
|
||||
val lpc = mouse.position.y / height
|
||||
|
||||
for (i in 1..fftSize / 2) {
|
||||
val t = i.toDouble() / (fftSize / 2 - 1)
|
||||
@@ -109,9 +110,9 @@ fun main() {
|
||||
drawer.stroke = ColorRGBa.GRAY.shade(0.5)
|
||||
drawer.lineSegments((0 until fft.size / 2).map {
|
||||
LineSegment(
|
||||
it.toDouble() * 2.0 + 0.5,
|
||||
it * 2.0 + 0.5,
|
||||
height * 0.5,
|
||||
it.toDouble() * 2.0 + 0.5,
|
||||
it * 2.0 + 0.5,
|
||||
height * 0.5 + fft.magnitude(it) / 200.0,
|
||||
)
|
||||
})
|
||||
@@ -129,9 +130,9 @@ fun main() {
|
||||
drawer.stroke = ColorRGBa.PINK.opacify(0.7)
|
||||
drawer.lineSegments((0 until fft.size / 2).map {
|
||||
LineSegment(
|
||||
it.toDouble() * 2.0 + 0.5,
|
||||
it * 2.0 + 0.5,
|
||||
height * 0.5,
|
||||
it.toDouble() * 2.0 + 0.5,
|
||||
it * 2.0 + 0.5,
|
||||
height * 0.5 + fft.magnitude(it) / 200.0,
|
||||
)
|
||||
})
|
||||
@@ -152,5 +153,4 @@ fun main() {
|
||||
drawer.contour(recenteredShape)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.fx.blend.*
|
||||
fun main() {
|
||||
application {
|
||||
|
||||
fun main() = application {
|
||||
program {
|
||||
val add = Add()
|
||||
val colorBurn = ColorBurn()
|
||||
@@ -25,5 +25,4 @@ fun main() {
|
||||
val xor = Xor()
|
||||
application.exit()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,7 @@ import org.openrndr.extra.fx.blur.*
|
||||
import org.openrndr.math.Polar
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
// In this buffer we will draw some simple shapes
|
||||
val dry = renderTarget(width / 3, height / 3) {
|
||||
@@ -38,15 +37,19 @@ fun main() {
|
||||
fill = null
|
||||
stroke = ColorRGBa.PINK
|
||||
strokeWeight = 25.0
|
||||
circle(bounds.center +
|
||||
circle(
|
||||
bounds.center +
|
||||
Polar(seconds * 50.0, 100.0).cartesian,
|
||||
200.0 + 50.0 * sin(seconds * 2.0))
|
||||
200.0 + 50.0 * sin(seconds * 2.0)
|
||||
)
|
||||
|
||||
fill = ColorRGBa.PINK
|
||||
stroke = null
|
||||
circle(bounds.center +
|
||||
circle(
|
||||
bounds.center +
|
||||
Polar(seconds * 50.0 + 60, 100.0).cartesian,
|
||||
100.0 + 20.0 * sin(seconds * 2.0 + 1))
|
||||
100.0 + 20.0 * sin(seconds * 2.0 + 1)
|
||||
)
|
||||
}
|
||||
|
||||
effects.forEachIndexed { i, blur ->
|
||||
@@ -56,33 +59,40 @@ fun main() {
|
||||
is BoxBlur -> {
|
||||
blur.window = 30
|
||||
}
|
||||
|
||||
is ApproximateGaussianBlur -> {
|
||||
blur.window = 25
|
||||
blur.sigma = 15.0
|
||||
}
|
||||
|
||||
is HashBlur -> {
|
||||
blur.samples = 50
|
||||
blur.radius = 5.0
|
||||
blur.time = seconds
|
||||
}
|
||||
|
||||
is GaussianBlur -> {
|
||||
blur.window = 25
|
||||
blur.sigma = 15.0
|
||||
}
|
||||
|
||||
is GaussianBloom -> {
|
||||
blur.window = 5
|
||||
blur.sigma = 3.0
|
||||
blur.gain = 3.0
|
||||
blur.noiseSeed = seconds
|
||||
}
|
||||
|
||||
is FrameBlur -> {
|
||||
blur.blend = 0.05
|
||||
}
|
||||
|
||||
is ZoomBlur -> {
|
||||
blur.center = Polar(seconds * 77.0, 0.5)
|
||||
.cartesian
|
||||
blur.strength = 0.8
|
||||
}
|
||||
|
||||
is LaserBlur -> {
|
||||
blur.center = Polar(seconds * 77.0, 0.5)
|
||||
.cartesian
|
||||
@@ -97,8 +107,10 @@ fun main() {
|
||||
|
||||
// Draw `wet` and write the effect name on top
|
||||
drawer.isolated {
|
||||
translate((i % 3) * width / 3.0,
|
||||
(i / 3) * height / 3.0)
|
||||
translate(
|
||||
(i % 3) * width / 3.0,
|
||||
(i / 3) * height / 3.0
|
||||
)
|
||||
image(wet)
|
||||
fontMap = font
|
||||
text(blur.javaClass.simpleName, 20.0, 30.0)
|
||||
@@ -106,5 +118,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,7 @@ import org.openrndr.draw.createEquivalent
|
||||
import org.openrndr.draw.loadImage
|
||||
import org.openrndr.extra.fx.color.Duotone
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
|
||||
val image = loadImage("demo-data/images/image-001.png")
|
||||
@@ -17,5 +16,4 @@ fun main() {
|
||||
drawer.image(filteredImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,7 @@ import org.openrndr.draw.createEquivalent
|
||||
import org.openrndr.draw.loadImage
|
||||
import org.openrndr.extra.fx.color.Posterize
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val image = loadImage("demo-data/images/image-001.png")
|
||||
val filteredImage = image.createEquivalent()
|
||||
@@ -16,5 +15,4 @@ fun main() {
|
||||
drawer.image(filteredImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,7 @@ import org.openrndr.draw.loadImage
|
||||
import org.openrndr.extra.fx.colormap.GrayscaleColormap
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val colormap = GrayscaleColormap()
|
||||
val image = loadImage("demo-data/images/image-001.png")
|
||||
@@ -17,5 +16,4 @@ fun main() {
|
||||
drawer.image(colormapImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,7 @@ import org.openrndr.draw.loadImage
|
||||
import org.openrndr.extra.fx.colormap.SpectralZucconiColormap
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val colormap = SpectralZucconiColormap()
|
||||
val image = loadImage("demo-data/images/image-001.png")
|
||||
@@ -17,5 +16,4 @@ fun main() {
|
||||
drawer.image(colormapImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,7 @@ import org.openrndr.draw.loadImage
|
||||
import org.openrndr.extra.fx.colormap.TurboColormap
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val colormap = TurboColormap()
|
||||
val image = loadImage("demo-data/images/image-001.png")
|
||||
@@ -17,5 +16,4 @@ fun main() {
|
||||
drawer.image(colormapImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,7 @@ import org.openrndr.extra.noise.*
|
||||
import org.openrndr.math.smoothstep
|
||||
import kotlin.math.cos
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
extend(Post()) {
|
||||
// -- create a color buffer and fill it with random direction vectors
|
||||
@@ -23,7 +22,11 @@ fun main() {
|
||||
for (y in 0 until height) {
|
||||
for (x in 0 until width) {
|
||||
val a = smoothstep(0.4, 0.6, cos((x + y) * 0.01) * 0.5 + 0.5)
|
||||
val nv = n(2320, x.toDouble(), y.toDouble()) * smoothstep(0.45, 0.55, ng(1032, x.toDouble(), y.toDouble()))
|
||||
val nv = n(2320, x.toDouble(), y.toDouble()) * smoothstep(
|
||||
0.45,
|
||||
0.55,
|
||||
ng(1032, x.toDouble(), y.toDouble())
|
||||
)
|
||||
s[x, y] = ColorRGBa(nv.x, nv.y, 0.0, 1.0)
|
||||
}
|
||||
}
|
||||
@@ -59,5 +62,4 @@ fun main() {
|
||||
drawer.image(image)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,7 @@ import org.openrndr.draw.createEquivalent
|
||||
import org.openrndr.draw.loadImage
|
||||
import org.openrndr.extra.fx.dither.LumaHalftone
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val image = loadImage("demo-data/images/image-001.png")
|
||||
val filteredImage = image.createEquivalent()
|
||||
@@ -14,12 +13,11 @@ fun main() {
|
||||
lumaHalftone.freq0 = 100.0
|
||||
lumaHalftone.gain1 = 1.0
|
||||
lumaHalftone.threshold = 0.5
|
||||
lumaHalftone.phase0 = seconds*0.1
|
||||
lumaHalftone.phase1 = -seconds*0.1
|
||||
lumaHalftone.phase0 = seconds * 0.1
|
||||
lumaHalftone.phase1 = -seconds * 0.1
|
||||
lumaHalftone.apply(image, filteredImage)
|
||||
lumaHalftone.invert = seconds.mod(2.0) < 1.0
|
||||
drawer.image(filteredImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,7 @@ import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.fx.distort.FluidDistort
|
||||
import org.openrndr.extra.fx.patterns.Checkers
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val fd = FluidDistort()
|
||||
val checkers = Checkers()
|
||||
@@ -28,5 +27,4 @@ fun main() {
|
||||
drawer.image(distorted)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
import org.openrndr.extra.fx.color.RgbToOkLab
|
||||
import org.openrndr.extra.fx.color.OkLabToRgb
|
||||
import org.openrndr.application
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.createEquivalent
|
||||
import org.openrndr.draw.loadImage
|
||||
import org.openrndr.extra.fx.color.OkLabToRgb
|
||||
import org.openrndr.extra.fx.color.RgbToOkLab
|
||||
|
||||
/**
|
||||
* This demonstrates converting a [ColorBuffer] from and to (OK)LAB color space using the [RgbToOkLab] and [OkLabToRgb]
|
||||
* filters. The (OK)Lab representation is signed and requires a floating point representation.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val rgbToOkLab = RgbToOkLab()
|
||||
val okLabToRgb = OkLabToRgb()
|
||||
@@ -23,5 +22,4 @@ fun main() {
|
||||
drawer.image(image)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ import org.openrndr.extra.fx.patterns.Checkers
|
||||
import org.openrndr.math.Vector2
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -41,5 +40,4 @@ fun main() {
|
||||
drawer.image(mixed)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,7 @@ import kotlin.random.Random
|
||||
* - Filters the generated points to enforce a minimum distance of 20.0 units between them.
|
||||
* - Visualizes the filtered points as circles with a radius of 10.0 units on the canvas.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -26,5 +25,4 @@ fun main() {
|
||||
drawer.circles(filteredPoints, 10.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,7 @@ import kotlin.random.Random
|
||||
* - Rectangles representing the bounds of the cells in the grid.
|
||||
* - Circles representing the generated points.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -37,8 +36,6 @@ fun main() {
|
||||
drawer.fill = null
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
drawer.circles(hashGrid.points().map { it.first }.toList(), 36.0)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,7 @@ import org.openrndr.draw.loadImage
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
// Load an image, convert to BoofCV format using orx-boofcv
|
||||
val input = loadImage("demo-data/images/image-001.png").toGrayF32()
|
||||
@@ -33,10 +32,14 @@ fun main() {
|
||||
val contours = BinaryImageOps.contour(filtered, ConnectRule.EIGHT, null)
|
||||
|
||||
// orx-boofcv: convert vector data to OPENRNDR ShapeContours
|
||||
val externalShapes = contours.toShapeContours(true,
|
||||
internal = false, external = true)
|
||||
val internalShapes = contours.toShapeContours(true,
|
||||
internal = true, external = false)
|
||||
val externalShapes = contours.toShapeContours(
|
||||
true,
|
||||
internal = false, external = true
|
||||
)
|
||||
val internalShapes = contours.toShapeContours(
|
||||
true,
|
||||
internal = true, external = false
|
||||
)
|
||||
|
||||
extend {
|
||||
drawer.run {
|
||||
@@ -61,5 +64,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,7 @@ import org.openrndr.boofcv.binding.resizeBy
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.loadImage
|
||||
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
// Load an image, convert to BoofCV format using orx-boofcv
|
||||
val input = loadImage("demo-data/images/image-001.png")
|
||||
@@ -22,5 +20,4 @@ fun main() {
|
||||
drawer.image(scaled3, scaled.bounds.width + scaled2.bounds.width, scaled.bounds.height - scaled3.height)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,7 @@ import org.openrndr.boofcv.binding.resizeTo
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.loadImage
|
||||
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
// Load an image, convert to BoofCV format using orx-boofcv
|
||||
val input = loadImage("demo-data/images/image-001.png")
|
||||
@@ -21,5 +19,4 @@ fun main() {
|
||||
drawer.image(scaled3, scaled.bounds.width + scaled2.bounds.width, scaled.bounds.height - scaled3.height)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,7 @@ import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.Rectangle
|
||||
import org.openrndr.shape.ShapeContour
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
// Create a buffer where to draw something for boofcv
|
||||
val rt = renderTarget(width, height) {
|
||||
@@ -30,8 +29,12 @@ fun main() {
|
||||
clear(ColorRGBa.BLACK)
|
||||
fill = ColorRGBa.WHITE
|
||||
stroke = null
|
||||
rectangle(Rectangle.fromCenter(bounds.position(0.33, 0.5),
|
||||
150.0, 150.0))
|
||||
rectangle(
|
||||
Rectangle.fromCenter(
|
||||
bounds.position(0.33, 0.5),
|
||||
150.0, 150.0
|
||||
)
|
||||
)
|
||||
translate(bounds.position(0.62, 0.5))
|
||||
rotate(30.0)
|
||||
rectangle(Rectangle.fromCenter(Vector2.ZERO, 200.0, 200.0))
|
||||
@@ -76,7 +79,6 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun imageToContours(input: ColorBuffer): List<ShapeContour> {
|
||||
|
||||
@@ -62,7 +62,7 @@ private fun SceneRenderer.processVoxelConeTracing(drawer: Drawer, scene: Scene,
|
||||
val position = Vector3.ZERO
|
||||
drawer.lookAt(position + side.forward*40.0, position , side.up)
|
||||
drawPass(drawer, pass, materialContext, context) {
|
||||
it.parameter("voxelMap", feature.voxelMap!!.imageBinding(0, ImageAccess.WRITE))
|
||||
it.image("voxelMap", feature.voxelMap!!.imageBinding(0, ImageAccess.WRITE))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@ import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.PathParameter
|
||||
import org.openrndr.extra.propertywatchers.watchingImagePath
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val gui = GUI()
|
||||
gui.compartmentsCollapsedByDefault = false
|
||||
@@ -24,5 +23,4 @@ fun main() {
|
||||
drawer.image(settings.image)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import org.openrndr.*
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.dialogs.*
|
||||
import org.openrndr.draw.Drawer
|
||||
import org.openrndr.extra.noise.random
|
||||
import org.openrndr.extra.noise.uniform
|
||||
import org.openrndr.extra.parameters.*
|
||||
import org.openrndr.internal.Driver
|
||||
@@ -1077,7 +1076,7 @@ open class GUI(
|
||||
val min = parameter.doubleRange!!.start
|
||||
val max = parameter.doubleRange!!.endInclusive
|
||||
val currentValue = (parameter.property as KMutableProperty1<Any, Double>).get(labeledObject.obj)
|
||||
val randomValue = random(min, max)
|
||||
val randomValue = Double.uniform(min, max)
|
||||
val newValue = mix(currentValue, randomValue, strength)
|
||||
(parameter.property as KMutableProperty1<Any, Double>).set(labeledObject.obj, newValue)
|
||||
}
|
||||
@@ -1086,7 +1085,7 @@ open class GUI(
|
||||
val min = parameter.intRange!!.first
|
||||
val max = parameter.intRange!!.last
|
||||
val currentValue = (parameter.property as KMutableProperty1<Any, Int>).get(labeledObject.obj)
|
||||
val randomValue = random(min.toDouble(), max.toDouble())
|
||||
val randomValue = Double.uniform(min.toDouble(), max.toDouble())
|
||||
val newValue = mix(currentValue.toDouble(), randomValue, strength).roundToInt()
|
||||
(parameter.property as KMutableProperty1<Any, Int>).set(labeledObject.obj, newValue)
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@ import org.openrndr.math.Vector2
|
||||
/**
|
||||
* Demonstration of two-way binding using [bindMidiControl]
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val midi = openMidiDevice("MIDI2x2 [hw:3,0,0]")
|
||||
val settings = object {
|
||||
@@ -37,5 +36,4 @@ fun main() {
|
||||
drawer.circle(drawer.bounds.center + Vector2(settings.x, settings.y), settings.radius)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,7 @@ import org.openrndr.extra.midi.openMidiDevice
|
||||
/**
|
||||
* Demonstration of [MidiConsole]
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
listMidiDevices().forEach { println(it.toString()) }
|
||||
val midi = openMidiDevice("Launchpad [hw:4,0,0]")
|
||||
@@ -15,5 +14,4 @@ fun main() {
|
||||
register(midi)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,7 @@ import kotlin.random.Random
|
||||
* Hold the mouse button to randomize the frequencies.
|
||||
* Press keys 'a' or 'b' for less random frequencies.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val minim = minim()
|
||||
val out = minim.lineOut
|
||||
@@ -106,5 +105,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
import ddf.minim.Minim
|
||||
import ddf.minim.analysis.FFT
|
||||
import ddf.minim.analysis.LanczosWindow
|
||||
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.minim.minim
|
||||
import org.openrndr.math.map
|
||||
import kotlin.math.ln
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
@@ -34,5 +32,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.minim.minim
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val minim = minim()
|
||||
if (minim.lineOut == null) {
|
||||
@@ -17,12 +16,11 @@ fun main() {
|
||||
player.shiftGain(player.gain, -40f, 15000)
|
||||
|
||||
extend {
|
||||
if(frameCount % 30 == 0) {
|
||||
if (frameCount % 30 == 0) {
|
||||
player.rewind()
|
||||
//player.gain = Random.nextDouble(-20.0, 0.0).toFloat()
|
||||
player.play()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ import kotlin.math.cos
|
||||
/**
|
||||
* Live-coding with [oliveProgram]
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
@@ -42,5 +41,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.draw.isolatedWithTarget
|
||||
import org.openrndr.draw.renderTarget
|
||||
import org.openrndr.extra.noise.Random
|
||||
import org.openrndr.extra.noise.uniform
|
||||
import org.openrndr.math.Polar
|
||||
import org.openrndr.math.clamp
|
||||
import org.openrndr.poissonfill.PoissonFill
|
||||
@@ -34,11 +35,11 @@ fun main() {
|
||||
val things = List(10) {
|
||||
Thing(
|
||||
ColorHSVa(it * 182.0,
|
||||
Random.double(0.3, 0.6),
|
||||
Random.double(0.1, 0.9)).toRGBa(),
|
||||
Polar(Random.double0(360.0),
|
||||
Double.uniform(0.3, 0.6),
|
||||
Double.uniform(0.1, 0.9)).toRGBa(),
|
||||
Polar(Double.uniform(0.0, 360.0),
|
||||
100.0 + it * 10.0),
|
||||
Polar(Random.double(-1.0, 1.0), 0.0))
|
||||
Polar(Double.uniform(-1.0, 1.0), 0.0))
|
||||
}
|
||||
val mouseTracker = MouseTracker(mouse)
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.draw.tint
|
||||
import org.openrndr.extra.realsense2.RS2Sensor
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val sensors = RS2Sensor.listSensors()
|
||||
val depthFrame = colorBuffer(640, 480, format = ColorFormat.R, type = ColorType.UINT16)
|
||||
@@ -30,5 +29,4 @@ fun main() {
|
||||
drawer.image(depthFrame)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,7 @@ import org.openrndr.extra.realsense2.RS2Sensor
|
||||
*
|
||||
* Tested with two sensors, only uses depth stream now
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
@@ -41,5 +40,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
import org.openrndr.application
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,20 +6,13 @@ import org.openrndr.draw.shadeStyle
|
||||
import org.openrndr.extra.camera.Orbital
|
||||
import org.openrndr.extra.mesh.IIndexedPolygon
|
||||
import org.openrndr.extra.mesh.IVertexData
|
||||
import org.openrndr.extra.mesh.noise.nonuniform
|
||||
import org.openrndr.extra.mesh.noise.nonuniformHammersley
|
||||
import org.openrndr.extra.mesh.noise.nonuniformRSeq
|
||||
import org.openrndr.extra.objloader.loadOBJMeshData
|
||||
import org.openrndr.extra.mesh.noise.uniform
|
||||
import org.openrndr.extra.meshgenerators.normals.estimateNormals
|
||||
import org.openrndr.extra.meshgenerators.sphereMesh
|
||||
import org.openrndr.math.Spherical
|
||||
import org.openrndr.extra.objloader.loadOBJMeshData
|
||||
import org.openrndr.math.Vector3
|
||||
import java.io.File
|
||||
import kotlin.math.absoluteValue
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.pow
|
||||
import kotlin.math.sin
|
||||
import kotlin.random.Random
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ import org.openrndr.drawImage
|
||||
import org.openrndr.extra.propertywatchers.watchingImagePath
|
||||
import org.openrndr.extra.propertywatchers.watchingProperty
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val state = object {
|
||||
var path = "demo-data/images/image-001.png"
|
||||
@@ -29,5 +28,4 @@ fun main() {
|
||||
drawer.image(state.redImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.propertywatchers.watchingProperty
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val state = object {
|
||||
val x by watchingProperty(mouse::position) {
|
||||
@@ -18,5 +17,4 @@ fun main() {
|
||||
state.x
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,7 @@ import org.openrndr.extra.quadtree.Quadtree
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -44,5 +43,4 @@ fun main() {
|
||||
drawer.circles(points, 5.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,7 @@ import org.openrndr.extra.quadtree.Quadtree
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -71,5 +70,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,7 @@ import org.openrndr.shape.Rectangle
|
||||
* Example of 5 gradient styles.
|
||||
* NPointLinear and NPoingGradient have separate demos.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 1000
|
||||
height = 500
|
||||
@@ -47,30 +46,36 @@ fun main() {
|
||||
gradient.length = 0.6
|
||||
gradient.offset = offset
|
||||
}
|
||||
|
||||
is AngularGradient -> {
|
||||
gradient.color1 = color1
|
||||
gradient.exponent = column / 3.0 + 0.3
|
||||
gradient.rotation = (seconds - column) * 10.0
|
||||
gradient.offset = offset
|
||||
}
|
||||
|
||||
is LinearGradient -> {
|
||||
gradient.color1 = color1
|
||||
gradient.exponent = column / 3.0 + 0.3
|
||||
gradient.rotation = seconds * 10.0
|
||||
}
|
||||
|
||||
is HalfAngularGradient -> {
|
||||
gradient.color1 = color1
|
||||
gradient.exponent = column / 3.0 + 0.3
|
||||
gradient.rotation = (column - seconds) * 10.0
|
||||
gradient.offset = offset
|
||||
}
|
||||
|
||||
is NPointGradient -> {
|
||||
// Animate points.
|
||||
// We could also animate colors.
|
||||
gradient.points = Array(gradient.colors.size) {
|
||||
rect.center + Polar(it * 90.0 +
|
||||
rect.center + Polar(
|
||||
it * 90.0 +
|
||||
column * 36 - seconds * 10,
|
||||
40.0).cartesian
|
||||
40.0
|
||||
).cartesian
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,5 +86,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,7 @@ import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.color.spaces.toOKLABa
|
||||
import org.openrndr.extra.shadestyles.linearGradient
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
extend {
|
||||
drawer.shadeStyle = linearGradient(
|
||||
@@ -18,8 +17,7 @@ fun main() {
|
||||
ColorRGBa.BLUE
|
||||
)
|
||||
|
||||
drawer.rectangle(120.0+200.0, 40.0, 200.0, 400.0)
|
||||
}
|
||||
drawer.rectangle(120.0 + 200.0, 40.0, 200.0, 400.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,7 @@ import kotlin.math.cos
|
||||
* on a static shape (a circle for example) or you can animate a shape
|
||||
* with a static gradient.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val numPoints = 8
|
||||
val gradient = NPointGradient(Array(numPoints) {
|
||||
@@ -42,5 +41,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,7 @@ import kotlin.math.sin
|
||||
* uniformly between 0.0 and 1.0 and then animated towards one of
|
||||
* the ends over time using pow() and sin(seconds).
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val numPoints = 8
|
||||
// Create gradients using two different color spaces
|
||||
@@ -62,5 +61,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,24 +6,27 @@ 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 {
|
||||
fun main() = application {
|
||||
program {
|
||||
val gradient = NPointRadialGradient(arrayOf(
|
||||
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))
|
||||
), arrayOf(0.0, 0.4, 0.5, 0.6, 1.0)
|
||||
)
|
||||
|
||||
val circles = List(25) {
|
||||
Circle(Random.nextDouble() * drawer.width,
|
||||
Circle(
|
||||
Random.nextDouble() * drawer.width,
|
||||
Random.nextDouble() * drawer.height,
|
||||
Random.nextDouble() * 150.0)
|
||||
Random.nextDouble() * 150.0
|
||||
)
|
||||
}
|
||||
|
||||
extend {
|
||||
@@ -36,5 +39,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,17 +3,15 @@ import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.shadestyles.radialGradient
|
||||
import kotlin.math.cos
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
extend {
|
||||
drawer.shadeStyle = radialGradient(
|
||||
ColorRGBa.PINK,
|
||||
ColorRGBa.PINK.toHSVa().shiftHue(180.0).shade(0.5).toRGBa(),
|
||||
exponent = cos(seconds)*0.5+0.5
|
||||
exponent = cos(seconds) * 0.5 + 0.5
|
||||
)
|
||||
drawer.rectangle(120.0, 40.0, 400.0, 400.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ import org.openrndr.shape.Circle
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -25,11 +24,10 @@ fun main() {
|
||||
vertex.rotate(seconds * 45.0)
|
||||
|
||||
selectVertex(1)
|
||||
vertex.scale(cos(seconds*0.943)*2.0)
|
||||
vertex.scale(cos(seconds * 0.943) * 2.0)
|
||||
}
|
||||
drawer.stroke = ColorRGBa.RED
|
||||
drawer.contour(contour)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ import org.openrndr.shape.Circle
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -22,7 +21,7 @@ fun main() {
|
||||
vertex.remove()
|
||||
selectVertex(0)
|
||||
vertex.moveBy(Vector2(cos(seconds) * 40.0, sin(seconds * 0.43) * 40.0))
|
||||
vertex.scale(cos(seconds*2.0)*2.0)
|
||||
vertex.scale(cos(seconds * 2.0) * 2.0)
|
||||
|
||||
|
||||
}
|
||||
@@ -30,5 +29,4 @@ fun main() {
|
||||
drawer.contour(contour)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,7 @@ import org.openrndr.math.Vector2
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -23,15 +22,15 @@ fun main() {
|
||||
}
|
||||
selectEdge(0)
|
||||
edge.scale(0.5, 0.5)
|
||||
edge.rotate(cos(seconds*0.5)*30.0)
|
||||
edge.rotate(cos(seconds * 0.5) * 30.0)
|
||||
selectEdge(1)
|
||||
edge.toCubic()
|
||||
edge.splitAt(0.5)
|
||||
edge.moveBy(Vector2(cos(seconds*10.0) * 40.0, 0.0))
|
||||
edge.moveBy(Vector2(cos(seconds * 10.0) * 40.0, 0.0))
|
||||
//edge.next?.select()
|
||||
selectEdge(3)
|
||||
|
||||
edge.moveBy(Vector2(0.0, sin(seconds*10.0) * 40.0))
|
||||
edge.moveBy(Vector2(0.0, sin(seconds * 10.0) * 40.0))
|
||||
|
||||
|
||||
}
|
||||
@@ -39,5 +38,4 @@ fun main() {
|
||||
drawer.contour(contour)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,7 @@ import org.openrndr.extra.shapes.adjust.adjustContour
|
||||
import org.openrndr.shape.Circle
|
||||
import kotlin.math.cos
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -27,5 +26,4 @@ fun main() {
|
||||
drawer.contour(contour)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,7 @@ import org.openrndr.extra.shapes.adjust.adjustContour
|
||||
import org.openrndr.shape.Circle
|
||||
import kotlin.math.cos
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -32,5 +31,4 @@ fun main() {
|
||||
drawer.contour(contour)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,7 @@ import org.openrndr.extra.shapes.adjust.adjustContour
|
||||
import org.openrndr.shape.Circle
|
||||
import kotlin.math.cos
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -23,7 +22,7 @@ fun main() {
|
||||
|
||||
|
||||
for (i in 0 until 4) {
|
||||
val splitT = cos(seconds + i * Math.PI*0.5)*0.2+0.5
|
||||
val splitT = cos(seconds + i * Math.PI * 0.5) * 0.2 + 0.5
|
||||
selectEdges { it -> true }
|
||||
for (e in edges) {
|
||||
e.splitAt(splitT)
|
||||
@@ -39,5 +38,4 @@ fun main() {
|
||||
drawer.contour(contour)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,7 @@ import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.contour
|
||||
import kotlin.math.cos
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -38,5 +37,4 @@ fun main() {
|
||||
drawer.contour(contour)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
//package adjust
|
||||
package adjust
|
||||
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
@@ -6,8 +6,7 @@ import org.openrndr.extra.shapes.adjust.adjustContour
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.contour
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -47,5 +46,4 @@ fun main() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,7 @@ import org.openrndr.extra.shapes.tunni.tunniLine
|
||||
import org.openrndr.extra.shapes.tunni.tunniPoint
|
||||
import kotlin.math.sqrt
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -56,5 +55,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,7 @@ import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.Segment2D
|
||||
import kotlin.math.cos
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -29,15 +28,15 @@ fun main() {
|
||||
sequence {
|
||||
for (i in 0 until 1000) {
|
||||
selectEdges()
|
||||
selectVertices((i*7).mod(4))
|
||||
selectVertices((i * 7).mod(4))
|
||||
for (v in vertices) {
|
||||
for (j in 0 until 30) {
|
||||
v.rotate(45.0/30.0)
|
||||
v.rotate(45.0 / 30.0)
|
||||
yield(status)
|
||||
}
|
||||
}
|
||||
|
||||
selectVertices((i*3).mod(4))
|
||||
selectVertices((i * 3).mod(4))
|
||||
for (v in vertices) {
|
||||
yield(status)
|
||||
|
||||
@@ -48,7 +47,7 @@ fun main() {
|
||||
selectEdges(i.mod(4))
|
||||
for (j in 0 until 30) {
|
||||
for (e in edges) {
|
||||
e.withTunniLine(e.tunniLine.position(0.5) + e.tunniLine.normal * cos(i.toDouble() + e.segmentIndex()) * 50.0/30.0)
|
||||
e.withTunniLine(e.tunniLine.position(0.5) + e.tunniLine.normal * cos(i.toDouble() + e.segmentIndex()) * 50.0 / 30.0)
|
||||
yield(status)
|
||||
}
|
||||
}
|
||||
@@ -98,5 +97,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,18 +12,17 @@ import org.openrndr.shape.Circle
|
||||
import kotlin.math.sqrt
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
val circles = listOf(
|
||||
Circle(drawer.bounds.center -Vector2(50.0, 0.0), 50.0),
|
||||
Circle(drawer.bounds.center - Vector2(50.0, 0.0), 50.0),
|
||||
Circle(drawer.bounds.center + Vector2(50.0, 0.0), 50.0),
|
||||
Circle(drawer.bounds.center + Vector2(0.0, 50.0), 50.0),
|
||||
Circle(drawer.bounds.center - Vector2(0.0, 50.0), 50.0),
|
||||
Circle(drawer.bounds.center -Vector2(50.0, 0.0), sqrt(50.0*50.0+50.0*50.0)-49.9),
|
||||
Circle(drawer.bounds.center +Vector2(50.0, 0.0), sqrt(50.0*50.0+50.0*50.0)-49.9),
|
||||
Circle(drawer.bounds.center -Vector2(0.0, 50.0), sqrt(50.0*50.0+50.0*50.0)-49.9),
|
||||
Circle(drawer.bounds.center +Vector2(0.0, 50.0), sqrt(50.0*50.0+50.0*50.0)-49.9),
|
||||
Circle(drawer.bounds.center - Vector2(50.0, 0.0), sqrt(50.0 * 50.0 + 50.0 * 50.0) - 49.9),
|
||||
Circle(drawer.bounds.center + Vector2(50.0, 0.0), sqrt(50.0 * 50.0 + 50.0 * 50.0) - 49.9),
|
||||
Circle(drawer.bounds.center - Vector2(0.0, 50.0), sqrt(50.0 * 50.0 + 50.0 * 50.0) - 49.9),
|
||||
Circle(drawer.bounds.center + Vector2(0.0, 50.0), sqrt(50.0 * 50.0 + 50.0 * 50.0) - 49.9),
|
||||
).shuffled()
|
||||
|
||||
val arr = Arrangement(circles)
|
||||
@@ -34,11 +33,13 @@ fun main() {
|
||||
for (f in arr.boundedFaces) {
|
||||
drawer.fill =
|
||||
|
||||
rgb(Double.uniform(0.0, 1.0, r), Double.uniform(0.0, 1.0, r), Double.uniform(0.0, 1.0, r)).saturate<OKHSV>(0.25)
|
||||
rgb(
|
||||
Double.uniform(0.0, 1.0, r),
|
||||
Double.uniform(0.0, 1.0, r),
|
||||
Double.uniform(0.0, 1.0, r)
|
||||
).saturate<OKHSV>(0.25)
|
||||
drawer.contour(f.contour)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,7 @@ import org.openrndr.shape.ShapeContour
|
||||
* The created contours are horizontal and vertical in "bezier-patch space" but
|
||||
* are rendered deformed following the shape of the bezier patch.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -30,7 +29,7 @@ fun main() {
|
||||
val c3 = LineSegment(pos(0.1, 0.9), pos(0.9, 0.9))
|
||||
|
||||
val bp = bezierPatch(c0.segment, c1.segment, c2.segment, c3.segment)
|
||||
val bpSub = bp.sub(0.1, 0.1, 0.6,0.6)
|
||||
val bpSub = bp.sub(0.1, 0.1, 0.6, 0.6)
|
||||
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
@@ -52,5 +51,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,7 @@ import org.openrndr.shape.ShapeContour
|
||||
* but one can manually create any other 4-segment closed contour
|
||||
* to use in bezier patches.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -35,5 +34,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,7 @@ import org.openrndr.shape.ShapeContour
|
||||
* In this case the contours are regular stars and the bezier patch
|
||||
* is created using a circular contour with the required 4 segments.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -54,5 +53,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,7 @@ import org.openrndr.shape.Circle
|
||||
* You can think of bezierPatch.position() as requesting points
|
||||
* in a wavy flag (the bezier patch) using normalized uv coordinates.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -42,5 +41,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ package bezierpatch
|
||||
import org.openrndr.WindowMultisample
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.shapes.bezierpatches.bezierPatch
|
||||
import org.openrndr.extra.camera.Orbital
|
||||
import org.openrndr.extra.shapes.bezierpatches.bezierPatch
|
||||
import org.openrndr.math.Vector3
|
||||
import org.openrndr.shape.Segment3D
|
||||
|
||||
@@ -19,8 +19,7 @@ import org.openrndr.shape.Segment3D
|
||||
* The created contours are horizontal and vertical in "bezier-patch space" but
|
||||
* are rendered deformed following the shape of the bezier patch.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -38,9 +37,9 @@ fun main() {
|
||||
val bpSub = bp.sub(0.1, 0.1, 0.6, 0.6)
|
||||
|
||||
val cam = Orbital()
|
||||
extend(cam){
|
||||
eye = Vector3(x=9.9, y=12.8, z=6.9)
|
||||
lookAt = Vector3(x=1.6, y=-1.9, z=1.2)
|
||||
extend(cam) {
|
||||
eye = Vector3(x = 9.9, y = 12.8, z = 6.9)
|
||||
lookAt = Vector3(x = 1.6, y = -1.9, z = 1.2)
|
||||
}
|
||||
|
||||
extend {
|
||||
@@ -70,5 +69,4 @@ fun main() {
|
||||
drawer.bezierPatch(bp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,12 @@ import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.shapes.bezierpatches.bezierPatch
|
||||
import org.openrndr.shape.Circle
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
val bp = bezierPatch(
|
||||
Circle(width/2.0, height/2.0, 200.0).contour
|
||||
Circle(width / 2.0, height / 2.0, 200.0).contour
|
||||
).withColors(
|
||||
listOf(
|
||||
listOf(ColorRGBa.PINK, ColorRGBa.RED, ColorRGBa.BLACK, ColorRGBa.BLUE),
|
||||
@@ -26,11 +25,10 @@ fun main() {
|
||||
drawer.fill = null
|
||||
drawer.contour(bp.contour)
|
||||
for (i in 0 until 10) {
|
||||
drawer.contour(bp.horizontal(i/9.0))
|
||||
drawer.contour(bp.horizontal(i / 9.0))
|
||||
}
|
||||
for (i in 0 until 10) {
|
||||
drawer.contour(bp.vertical(i/9.0))
|
||||
}
|
||||
drawer.contour(bp.vertical(i / 9.0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@ import org.openrndr.extra.color.spaces.toOKLABa
|
||||
import org.openrndr.extra.shapes.bezierpatches.bezierPatch
|
||||
import org.openrndr.shape.Circle
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -17,7 +16,7 @@ fun main() {
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
val bp2 = bezierPatch(
|
||||
Circle(width/2.0 - 180.0, height/2.0, 170.0).contour
|
||||
Circle(width / 2.0 - 180.0, height / 2.0, 170.0).contour
|
||||
).withColors(
|
||||
listOf(
|
||||
listOf(ColorRGBa.PINK, ColorRGBa.PINK, ColorRGBa.PINK, ColorRGBa.PINK),
|
||||
@@ -28,22 +27,41 @@ fun main() {
|
||||
)
|
||||
drawer.bezierPatch(bp2)
|
||||
val bp3 = bezierPatch(
|
||||
Circle(width/2.0 + 180.0, height/2.0, 170.0).contour
|
||||
Circle(width / 2.0 + 180.0, height / 2.0, 170.0).contour
|
||||
).withColors(
|
||||
listOf(
|
||||
listOf(ColorRGBa.PINK.toOKLABa(), ColorRGBa.PINK.toOKLABa(), ColorRGBa.PINK.toOKLABa(), ColorRGBa.PINK.toOKLABa()),
|
||||
listOf(ColorRGBa.RED.toOKLABa(), ColorRGBa.RED.toOKLABa(), ColorRGBa.RED.toOKLABa(), ColorRGBa.RED.toOKLABa()),
|
||||
listOf(ColorRGBa.BLUE.toOKLABa(), ColorRGBa.BLUE.toOKLABa(), ColorRGBa.BLUE.toOKLABa(), ColorRGBa.BLUE.toOKLABa()),
|
||||
listOf(ColorRGBa.WHITE.toOKLABa(), ColorRGBa.WHITE.toOKLABa(), ColorRGBa.WHITE.toOKLABa(), ColorRGBa.WHITE.toOKLABa()),
|
||||
listOf(
|
||||
ColorRGBa.PINK.toOKLABa(),
|
||||
ColorRGBa.PINK.toOKLABa(),
|
||||
ColorRGBa.PINK.toOKLABa(),
|
||||
ColorRGBa.PINK.toOKLABa()
|
||||
),
|
||||
listOf(
|
||||
ColorRGBa.RED.toOKLABa(),
|
||||
ColorRGBa.RED.toOKLABa(),
|
||||
ColorRGBa.RED.toOKLABa(),
|
||||
ColorRGBa.RED.toOKLABa()
|
||||
),
|
||||
listOf(
|
||||
ColorRGBa.BLUE.toOKLABa(),
|
||||
ColorRGBa.BLUE.toOKLABa(),
|
||||
ColorRGBa.BLUE.toOKLABa(),
|
||||
ColorRGBa.BLUE.toOKLABa()
|
||||
),
|
||||
listOf(
|
||||
ColorRGBa.WHITE.toOKLABa(),
|
||||
ColorRGBa.WHITE.toOKLABa(),
|
||||
ColorRGBa.WHITE.toOKLABa(),
|
||||
ColorRGBa.WHITE.toOKLABa()
|
||||
),
|
||||
)
|
||||
)
|
||||
drawer.bezierPatch(bp3)
|
||||
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
drawer.fontMap = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 16.0)
|
||||
drawer.text("RGB", width/2.0 - 180.0, height/2.0 + 200.0)
|
||||
drawer.text("OKLab", width/2.0 + 180.0, height/2.0 + 200.0)
|
||||
}
|
||||
drawer.text("RGB", width / 2.0 - 180.0, height / 2.0 + 200.0)
|
||||
drawer.text("OKLab", width / 2.0 + 180.0, height / 2.0 + 200.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,7 @@ import org.openrndr.shape.Circle
|
||||
import org.openrndr.shape.Rectangle
|
||||
import kotlin.math.min
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -23,13 +22,33 @@ fun main() {
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
val colors = listOf(
|
||||
listOf(ColorRGBa.PINK.toOKLABa(), ColorRGBa.PINK.toOKLABa(), ColorRGBa.PINK.toOKLABa(), ColorRGBa.PINK.toOKLABa()),
|
||||
listOf(ColorRGBa.RED.toOKLABa(), ColorRGBa.RED.toOKLABa(), ColorRGBa.RED.toOKLABa(), ColorRGBa.RED.toOKLABa()),
|
||||
listOf(ColorRGBa.BLUE.toOKLABa(), ColorRGBa.BLUE.toOKLABa(), ColorRGBa.BLUE.toOKLABa(), ColorRGBa.BLUE.toOKLABa()),
|
||||
listOf(ColorRGBa.WHITE.toOKLABa(), ColorRGBa.WHITE.toOKLABa(), ColorRGBa.WHITE.toOKLABa(), ColorRGBa.WHITE.toOKLABa()),
|
||||
listOf(
|
||||
ColorRGBa.PINK.toOKLABa(),
|
||||
ColorRGBa.PINK.toOKLABa(),
|
||||
ColorRGBa.PINK.toOKLABa(),
|
||||
ColorRGBa.PINK.toOKLABa()
|
||||
),
|
||||
listOf(
|
||||
ColorRGBa.RED.toOKLABa(),
|
||||
ColorRGBa.RED.toOKLABa(),
|
||||
ColorRGBa.RED.toOKLABa(),
|
||||
ColorRGBa.RED.toOKLABa()
|
||||
),
|
||||
listOf(
|
||||
ColorRGBa.BLUE.toOKLABa(),
|
||||
ColorRGBa.BLUE.toOKLABa(),
|
||||
ColorRGBa.BLUE.toOKLABa(),
|
||||
ColorRGBa.BLUE.toOKLABa()
|
||||
),
|
||||
listOf(
|
||||
ColorRGBa.WHITE.toOKLABa(),
|
||||
ColorRGBa.WHITE.toOKLABa(),
|
||||
ColorRGBa.WHITE.toOKLABa(),
|
||||
ColorRGBa.WHITE.toOKLABa()
|
||||
),
|
||||
)
|
||||
|
||||
val grid = drawer.bounds.grid(4,4, marginX = 20.0, marginY = 20.0, gutterX = 10.0, gutterY = 10.0)
|
||||
val grid = drawer.bounds.grid(4, 4, marginX = 20.0, marginY = 20.0, gutterX = 10.0, gutterY = 10.0)
|
||||
|
||||
val cellWidth = grid[0][0].width
|
||||
val cellHeight = grid[0][0].height
|
||||
@@ -57,5 +76,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,7 @@ import org.openrndr.shape.ShapeContour
|
||||
* but one can manually create any other 4-segment closed contour
|
||||
* to use in bezier patches.
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -25,7 +24,7 @@ fun main() {
|
||||
val c0 = Circle(width / 3.0, height / 2.0, 150.0).contour
|
||||
val bp0 = bezierPatch(c0)
|
||||
|
||||
val c1 = Circle(2.0*width / 3.0, height / 2.0, 150.0).contour
|
||||
val c1 = Circle(2.0 * width / 3.0, height / 2.0, 150.0).contour
|
||||
val bp1 = bezierPatch(c1)
|
||||
|
||||
|
||||
@@ -33,5 +32,4 @@ fun main() {
|
||||
drawer.bezierPatches(listOf(bp0, bp1))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,10 @@ import org.openrndr.shape.Circle
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
|
||||
|
||||
/**
|
||||
* Demonstration of uniform contour blending
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -33,5 +31,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,7 @@ import kotlin.math.cos
|
||||
/**
|
||||
* Demonstration of non-uniform contour blending
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -35,5 +34,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,7 @@ import org.openrndr.math.Vector3
|
||||
import org.openrndr.shape.path3D
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -28,21 +27,21 @@ fun main() {
|
||||
val p = path3D {
|
||||
moveTo(0.0, 0.0, 0.0)
|
||||
curveTo(
|
||||
Vector3.uniformRing(0.1, 1.0, random = random)*10.0,
|
||||
Vector3.uniformRing(0.1, 1.0, random = random)*10.0,
|
||||
Vector3.uniformRing(0.1, 1.0, random = random)*10.0
|
||||
Vector3.uniformRing(0.1, 1.0, random = random) * 10.0,
|
||||
Vector3.uniformRing(0.1, 1.0, random = random) * 10.0,
|
||||
Vector3.uniformRing(0.1, 1.0, random = random) * 10.0
|
||||
)
|
||||
for (i in 0 until 10) {
|
||||
continueTo(
|
||||
Vector3.uniformRing(0.1, 1.0, random = random)*10.0,
|
||||
Vector3.uniformRing(0.1, 1.0, random = random)*10.0
|
||||
Vector3.uniformRing(0.1, 1.0, random = random) * 10.0,
|
||||
Vector3.uniformRing(0.1, 1.0, random = random) * 10.0
|
||||
)
|
||||
}
|
||||
}
|
||||
val pr = p.rectified(0.01, 100.0)
|
||||
|
||||
|
||||
val frames = pr.frames((0 until 100).map { it / 100.0}, Vector3.UNIT_Y, analyticalDirections = false)
|
||||
val frames = pr.frames((0 until 100).map { it / 100.0 }, Vector3.UNIT_Y, analyticalDirections = false)
|
||||
extend(Orbital())
|
||||
extend {
|
||||
drawer.shadeStyle = shadeStyle {
|
||||
@@ -60,8 +59,6 @@ fun main() {
|
||||
drawer.vertexBuffer(cylinder, DrawPrimitive.TRIANGLES)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,7 @@ import org.openrndr.extra.noise.uniform
|
||||
import org.openrndr.extra.shapes.ordering.hilbertOrder
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -21,5 +20,4 @@ fun main() {
|
||||
drawer.lineStrip(sortedPoints)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,9 @@ import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.noise.uniform
|
||||
import org.openrndr.extra.shapes.ordering.hilbertOrder
|
||||
import org.openrndr.extra.shapes.ordering.mortonOrder
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -25,5 +23,4 @@ fun main() {
|
||||
drawer.lineStrip(sortedPoints1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,25 +4,19 @@ import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.LineJoin
|
||||
import org.openrndr.extra.camera.Orbital
|
||||
import org.openrndr.extra.noise.uniformRing
|
||||
import org.openrndr.extra.shapes.path3d.projectToContour
|
||||
import org.openrndr.math.Spherical
|
||||
import org.openrndr.math.Vector3
|
||||
import org.openrndr.shape.path3D
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
fun main() = application {
|
||||
program {
|
||||
val path = path3D {
|
||||
var p = Vector3(1.0, 0.0, 0.0)
|
||||
moveTo(p * 6.0)
|
||||
for (i in 0 until 400) {
|
||||
p += Vector3.uniformRing(0.2, 0.5)
|
||||
p = p.normalized
|
||||
arcTo(5.0, cursor.atan2(p * 6.0), false, false, p * 6.0)
|
||||
var p = Vector3(6.0, 0.0, 0.0)
|
||||
moveTo(p)
|
||||
for (i in 0 until 100) {
|
||||
p = Spherical((i % 6) * 45.0, (i % 4 + 1) * 30.0 + i * 0.1, 6.0).cartesian
|
||||
arcTo(5.0, cursor.atan2(p), false, false, p)
|
||||
}
|
||||
}
|
||||
extend(Orbital())
|
||||
@@ -37,5 +31,4 @@ fun main() {
|
||||
drawer.contour(c)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,7 @@ import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.shapes.primitives.Arc
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -20,5 +19,4 @@ fun main() {
|
||||
drawer.circle(a.position(1.0), 5.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,7 @@ import org.openrndr.extra.shapes.primitives.Net
|
||||
import org.openrndr.shape.Circle
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
program {
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
@@ -30,5 +29,4 @@ fun main() {
|
||||
drawer.contour(net.contour)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,7 @@ import org.openrndr.extra.shapes.primitives.Pulley
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.Circle
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -24,5 +23,4 @@ fun main() {
|
||||
drawer.contour(pulley.contour)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,7 @@ import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.shapes.primitives.grid
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
@@ -24,5 +23,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,7 @@ import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.noise.Random
|
||||
import org.openrndr.extra.shapes.primitives.grid
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
// Try changing the resolution. The design will use the available space.
|
||||
configure {
|
||||
width = 800
|
||||
@@ -16,8 +15,10 @@ fun main() {
|
||||
// By specifying the cell size we make sure the design will
|
||||
// contain squares, independently of the window size and its
|
||||
// aspect ratio.
|
||||
val grid = drawer.bounds.grid(50.0, 50.0,
|
||||
20.0, 20.0, 20.0, 20.0).flatten()
|
||||
val grid = drawer.bounds.grid(
|
||||
50.0, 50.0,
|
||||
20.0, 20.0, 20.0, 20.0
|
||||
).flatten()
|
||||
|
||||
val grid2 = grid.map { rect ->
|
||||
// Each of these inner grids will occupy the available space
|
||||
@@ -26,7 +27,7 @@ fun main() {
|
||||
// rows)
|
||||
val count = Random.int(1, 4)
|
||||
rect.grid(count, count, 5.0, 5.0, 5.0, 5.0).flatten()
|
||||
}.flatten().filter { Random.bool(0.5)}
|
||||
}.flatten().filter { Random.bool(0.5) }
|
||||
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
@@ -35,5 +36,4 @@ fun main() {
|
||||
drawer.rectangles(grid2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ import org.openrndr.extra.shapes.primitives.intersection
|
||||
* Demonstrate rectangle-rectangle intersection
|
||||
* @see <img src="https://raw.githubusercontent.com/openrndr/orx/media/orx-shapes/images/primitives-DemoRectangleIntersection01Kt.png">
|
||||
*/
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -36,5 +35,4 @@ fun main() {
|
||||
drawer.rectangle(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.Circle
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -27,5 +26,4 @@ fun main() {
|
||||
drawer.contours(tears.map { it.contour })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,7 @@ import org.openrndr.extra.shapes.hobbycurve.hobbyCurve
|
||||
import org.openrndr.extra.shapes.rectify.rectified
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -22,11 +21,10 @@ fun main() {
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
drawer.contour(curve)
|
||||
drawer.fill = ColorRGBa.RED
|
||||
drawer.circle(curve.position(seconds*0.05), 10.0)
|
||||
drawer.circle(curve.position(seconds * 0.05), 10.0)
|
||||
drawer.fill = ColorRGBa.GREEN
|
||||
drawer.circle(rectified.position(seconds*0.05), 10.0)
|
||||
drawer.circle(rectified.position(seconds * 0.05), 10.0)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,7 @@ import org.openrndr.extra.shapes.hobbycurve.hobbyCurve
|
||||
import org.openrndr.extra.shapes.rectify.rectified
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -25,11 +24,10 @@ fun main() {
|
||||
drawer.strokeWeight = 4.0
|
||||
|
||||
drawer.stroke = ColorRGBa.RED
|
||||
drawer.contour(curve.sub(seconds*0.1, seconds*0.1+0.01))
|
||||
drawer.contour(curve.sub(seconds * 0.1, seconds * 0.1 + 0.01))
|
||||
|
||||
drawer.stroke = ColorRGBa.GREEN
|
||||
drawer.contour(rectified.sub(seconds*0.1, seconds*0.1+0.01))
|
||||
}
|
||||
drawer.contour(rectified.sub(seconds * 0.1, seconds * 0.1 + 0.01))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,7 @@ import org.openrndr.extra.shapes.hobbycurve.hobbyCurve
|
||||
import org.openrndr.extra.shapes.rectify.rectified
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -24,11 +23,10 @@ fun main() {
|
||||
drawer.contour(curve)
|
||||
|
||||
val points = (0 until 100).map {
|
||||
rectified.position(it/100.0)
|
||||
rectified.position(it / 100.0)
|
||||
}
|
||||
drawer.circles(points, 5.0)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,7 @@ import org.openrndr.extra.shapes.rectify.rectified
|
||||
import org.openrndr.math.Vector3
|
||||
import org.openrndr.shape.path3D
|
||||
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -25,9 +23,9 @@ fun main() {
|
||||
moveTo(0.0, 0.0, 0.0)
|
||||
for (i in 0 until 10) {
|
||||
curveTo(
|
||||
Vector3.uniformRing(0.1, 1.0)*10.0,
|
||||
Vector3.uniformRing(0.1, 1.0)*10.0,
|
||||
Vector3.uniformRing(0.1, 1.0)*10.0
|
||||
Vector3.uniformRing(0.1, 1.0) * 10.0,
|
||||
Vector3.uniformRing(0.1, 1.0) * 10.0,
|
||||
Vector3.uniformRing(0.1, 1.0) * 10.0
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -38,12 +36,11 @@ fun main() {
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
for (i in 0 until 500) {
|
||||
drawer.isolated {
|
||||
drawer.translate(pr.position(i/499.0))
|
||||
drawer.translate(pr.position(i / 499.0))
|
||||
drawer.vertexBuffer(sphere, DrawPrimitive.TRIANGLES)
|
||||
}
|
||||
}
|
||||
drawer.path(p)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,7 @@ import org.openrndr.draw.font.loadFace
|
||||
import org.openrndr.extra.shapes.bounds.bounds
|
||||
import org.openrndr.extra.shapes.text.shapesFromText
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
@@ -27,5 +25,4 @@ fun main() {
|
||||
drawer.shapes(shapes)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user