Fix demos (#331)
This commit is contained in:
@@ -22,8 +22,8 @@ kotlin {
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
val jvmDemo by getting {
|
||||
dependencies {
|
||||
implementation(project(":orx-shapes"))
|
||||
implementation(project(":orx-svg"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.composition.ClipMode
|
||||
import org.openrndr.extra.composition.composition
|
||||
import org.openrndr.extra.composition.drawComposition
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
program {
|
||||
val cd = drawComposition {
|
||||
fill = null
|
||||
circle(width / 2.0, height / 2.0, 100.0)
|
||||
|
||||
fill = ColorRGBa.BLACK
|
||||
clipMode = ClipMode.REVERSE_DIFFERENCE
|
||||
circle(width / 2.0 + 50.0, height / 2.0, 100.0)
|
||||
}
|
||||
|
||||
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
drawer.composition(cd)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.composition.ClipMode
|
||||
import org.openrndr.extra.composition.composition
|
||||
import org.openrndr.extra.composition.drawComposition
|
||||
|
||||
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)
|
||||
|
||||
fill = ColorRGBa.BLACK
|
||||
circle(width / 2.0, height / 2.0, 100.0)
|
||||
}
|
||||
|
||||
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
drawer.composition(cd)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user