-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathDemoGradient09.kt
47 lines (42 loc) · 1.53 KB
/
DemoGradient09.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package gradients
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.loadImage
import org.openrndr.extra.color.presets.CRIMSON
import org.openrndr.extra.color.presets.DODGER_BLUE
import org.openrndr.extra.color.presets.LIME_GREEN
import org.openrndr.extra.imageFit.imageFit
import org.openrndr.extra.shadestyles.fills.SpreadMethod
import org.openrndr.extra.shadestyles.fills.gradients.gradient
import org.openrndr.extra.shadestyles.fills.patterns.pattern
fun main() = application {
configure {
width = 720
height = 720
}
program {
val image = loadImage("demo-data/images/image-001.png")
extend {
drawer.shadeStyle = pattern {
foregroundColor = ColorRGBa.WHITE
backgroundColor = ColorRGBa.WHITE.shade(0.75)
checkers {
scale = 72.0
}
}
drawer.rectangle(drawer.bounds.offsetEdges(-10.0))
drawer.shadeStyle = gradient<ColorRGBa> {
stops[0.0] = ColorRGBa.CRIMSON.opacify(0.0)
stops[0.19] = ColorRGBa.CRIMSON.opacify(0.0)
stops[0.25] = ColorRGBa.DODGER_BLUE.opacify(1.0)
stops[1.0] = ColorRGBa.LIME_GREEN.opacify(1.0)
spreadMethod = SpreadMethod.REFLECT
luma {
minLevel = 0.1
maxLevel = 0.9
}
}
drawer.imageFit(image, drawer.bounds.offsetEdges(-10.0))
}
}
}