-
Notifications
You must be signed in to change notification settings - Fork 37
/
DemoCompositionDrawer01.kt
42 lines (37 loc) · 1.38 KB
/
DemoCompositionDrawer01.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
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 {
program {
val composition = drawComposition {
val layer = group {
fill = ColorRGBa.PINK
stroke = ColorRGBa.BLACK
strokeWeight = 10.0
circle(Vector2(width / 2.0, height / 2.0), 100.0)
circle(Vector2(200.0, 200.0), 50.0)
}
// demonstrating how to set custom attributes on the CompositionNode
// these are stored in SVG
//layer.id = "Layer_2"
//layer.attributes["inkscape:label"] = "Layer 1"
//layer.attributes["inkscape:groupmode"] = "layer"
}
// print the svg to the console
println(composition.toSVG())
// save svg to a File
//composition.saveToFile(File("/path/to/design.svg"))
extend {
drawer.clear(ColorRGBa.WHITE)
// draw the composition to the screen
drawer.composition(composition)
}
}
}
}