-
Notifications
You must be signed in to change notification settings - Fork 37
/
DemoFluidDistort01.kt
32 lines (29 loc) · 1.02 KB
/
DemoFluidDistort01.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import org.openrndr.application
import org.openrndr.draw.colorBuffer
import org.openrndr.draw.createEquivalent
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.fx.distort.FluidDistort
import org.openrndr.extra.fx.patterns.Checkers
fun main() {
application {
program {
val fd = FluidDistort()
val checkers = Checkers()
val image = colorBuffer(width, height)
val distorted = image.createEquivalent()
checkers.size = 64.0
checkers.apply(emptyArray(), image)
if (System.getProperty("takeScreenshot") == "true") {
extensions.filterIsInstance<SingleScreenshot>().forEach {
it.delayFrames = 150
}
}
extend {
// Ensure >0.01 for a better screenshot
fd.blend = (mouse.position.x / width).coerceAtLeast(0.01)
fd.apply(image, distorted)
drawer.image(distorted)
}
}
}
}