-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
118 changed files
with
353 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...awing_basics/C100_DrawingPrimitives000.kt → ...Drawing/C100_CirclesRectanglesLines000.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...awing_basics/C100_DrawingPrimitives001.kt → ...Drawing/C100_CirclesRectanglesLines001.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...awing_basics/C100_DrawingPrimitives002.kt → ...Drawing/C100_CirclesRectanglesLines002.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...awing_basics/C100_DrawingPrimitives003.kt → ...Drawing/C100_CirclesRectanglesLines003.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mples/04_Drawing_basics/C110_Images000.kt → ...lin/examples/04_Drawing/C110_Images000.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mples/04_Drawing_basics/C110_Images001.kt → ...lin/examples/04_Drawing/C110_Images001.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mples/04_Drawing_basics/C110_Images002.kt → ...lin/examples/04_Drawing/C110_Images002.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mples/04_Drawing_basics/C110_Images003.kt → ...lin/examples/04_Drawing/C110_Images003.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mples/04_Drawing_basics/C110_Images004.kt → ...lin/examples/04_Drawing/C110_Images004.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mples/04_Drawing_basics/C110_Images005.kt → ...lin/examples/04_Drawing/C110_Images005.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mples/04_Drawing_basics/C110_Images006.kt → ...lin/examples/04_Drawing/C110_Images006.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...xamples/04_Drawing_basics/C120_Text000.kt → ...otlin/examples/04_Drawing/C120_Text000.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...xamples/04_Drawing_basics/C120_Text001.kt → ...otlin/examples/04_Drawing/C120_Text001.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...xamples/04_Drawing_basics/C120_Text002.kt → ...otlin/examples/04_Drawing/C120_Text002.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...xamples/04_Drawing_basics/C120_Text003.kt → ...otlin/examples/04_Drawing/C120_Text003.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...amples/04_Drawing_basics/C130_Color000.kt → ...tlin/examples/04_Drawing/C130_Color000.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...amples/04_Drawing_basics/C130_Color001.kt → ...tlin/examples/04_Drawing/C130_Color001.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...amples/04_Drawing_basics/C130_Color002.kt → ...tlin/examples/04_Drawing/C130_Color002.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...amples/04_Drawing_basics/C130_Color003.kt → ...tlin/examples/04_Drawing/C130_Color003.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/kotlin/examples/04_Drawing/C150_CurvesAndShapes000.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
package examples.`04_Drawing` | ||
|
||
import org.openrndr.application | ||
import org.openrndr.color.ColorRGBa | ||
import org.openrndr.draw.LineJoin | ||
import org.openrndr.draw.loadFont | ||
import org.openrndr.extra.shapes.hobbyCurve | ||
import org.openrndr.math.Vector2 | ||
import org.openrndr.math.transforms.transform | ||
import org.openrndr.shape.* | ||
import kotlin.math.cos | ||
import kotlin.math.sin | ||
|
||
fun main() { | ||
application { | ||
configure { | ||
height = 200 | ||
} | ||
program { | ||
val font = loadFont("data/fonts/default.otf", 16.0) | ||
val pts = listOf(Vector2(50.0, 55.0), Vector2(100.0, height - 40.0), Vector2(200.0, 35.0), Vector2(280.0, 50.0), Vector2(250.0, height - 40.0), Vector2(500.0, 35.0), Vector2(550.0, height * 0.5), Vector2(400.0, height * 0.6), Vector2(450.0, height - 40.0)) | ||
val off = Vector2(10.0, 0.0) | ||
val off2 = Vector2(-20.0, 20.0) | ||
extend { | ||
drawer.clear(ColorRGBa.WHITE) | ||
drawer.fontMap = font | ||
|
||
drawer.stroke = null | ||
drawer.fill = ColorRGBa.fromHex("#ff7990") | ||
drawer.circles(pts.subList(0, 2), 4.0) | ||
drawer.fill = ColorRGBa.fromHex("#70e1e1") | ||
drawer.circles(pts.subList(2, 5), 4.0) | ||
drawer.fill = ColorRGBa.fromHex("#ff9b41") | ||
drawer.circles(pts.subList(5, 9), 4.0) | ||
|
||
|
||
drawer.fill = ColorRGBa.BLACK | ||
drawer.text("start", pts[0] + off) | ||
drawer.text("end", pts[1] + off) | ||
drawer.text("Linear", pts[1] + off2) | ||
|
||
drawer.text("start", pts[2] + off) | ||
drawer.text("control point", pts[3] + off) | ||
drawer.text("end", pts[4] + off) | ||
drawer.text("Quadratic", pts[4] + off2) | ||
|
||
drawer.text("start", pts[5] + off) | ||
drawer.text("cp 1", pts[6] + off) | ||
drawer.text("cp 2", pts[7] + off) | ||
drawer.text("end", pts[8] + off) | ||
drawer.text("Cubic", pts[8] + off2) | ||
|
||
drawer.stroke = ColorRGBa.BLACK | ||
drawer.segment(Segment(pts[0], pts[1])) | ||
drawer.segment(Segment(pts[2], pts[3], pts[4])) | ||
drawer.segment(Segment(pts[5], pts[6], pts[7], pts[8])) | ||
} | ||
} | ||
} | ||
} | ||
|
43 changes: 43 additions & 0 deletions
43
src/main/kotlin/examples/04_Drawing/C150_CurvesAndShapes001.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
package examples.`04_Drawing` | ||
|
||
import org.openrndr.application | ||
import org.openrndr.color.ColorRGBa | ||
import org.openrndr.draw.LineJoin | ||
import org.openrndr.draw.loadFont | ||
import org.openrndr.extra.shapes.hobbyCurve | ||
import org.openrndr.math.Vector2 | ||
import org.openrndr.math.transforms.transform | ||
import org.openrndr.shape.* | ||
import kotlin.math.cos | ||
import kotlin.math.sin | ||
|
||
fun main() { | ||
application { | ||
configure { | ||
height = 160 | ||
} | ||
program { | ||
val font = loadFont("data/fonts/default.otf", 16.0) | ||
val contours = listOf(Circle(100.0, height / 2.0, 50.0).contour, Rectangle.fromCenter(Vector2(280.0, height / 2.0), 100.0).contour, hobbyCurve(listOf(Vector2(400.0, 50.0), Vector2(450.0, 120.0), Vector2(500.0, 80.0), Vector2(600.0, 130.0), Vector2(550.0, 80.0)))) | ||
|
||
extend { | ||
drawer.clear(ColorRGBa.WHITE) | ||
drawer.fontMap = font | ||
|
||
drawer.stroke = null | ||
drawer.fill = ColorRGBa.PINK | ||
drawer.circles(contours.map { c -> | ||
c.segments.map { seg -> | ||
seg.start | ||
} + c.position(1.0) | ||
}.flatten(), 5.0) | ||
|
||
drawer.fill = null | ||
drawer.stroke = ColorRGBa.BLACK | ||
drawer.contours(contours) | ||
} | ||
} | ||
} | ||
} | ||
|
17 changes: 8 additions & 9 deletions
17
...4_Drawing_basics/C150_ComplexShapes000.kt → ...les/04_Drawing/C150_CurvesAndShapes002.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/kotlin/examples/04_Drawing/C150_CurvesAndShapes003.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
package examples.`04_Drawing` | ||
|
||
import org.openrndr.application | ||
import org.openrndr.color.ColorRGBa | ||
import org.openrndr.draw.LineJoin | ||
import org.openrndr.draw.loadFont | ||
import org.openrndr.extra.shapes.hobbyCurve | ||
import org.openrndr.math.Vector2 | ||
import org.openrndr.math.transforms.transform | ||
import org.openrndr.shape.* | ||
import kotlin.math.cos | ||
import kotlin.math.sin | ||
|
||
fun main() { | ||
application { | ||
program { | ||
val points = List(20) { | ||
Vector2(20.0 + it * 32.0, 100.0 + sin(it * 1.0) * it * 3) | ||
} | ||
val wavyContour = ShapeContour.fromPoints(points, closed = false) | ||
val smoothContour = hobbyCurve(points, closed = false) | ||
|
||
extend { | ||
drawer.clear(ColorRGBa.WHITE) | ||
drawer.fill = null | ||
drawer.strokeWeight = 5.0 | ||
drawer.stroke = ColorRGBa.PINK | ||
drawer.contour(wavyContour) | ||
|
||
drawer.translate(0.0, 10.0) // displace 10px down | ||
drawer.stroke = ColorRGBa.BLACK.opacify(0.5) | ||
drawer.contour(smoothContour) | ||
} | ||
} | ||
} | ||
} | ||
|
17 changes: 6 additions & 11 deletions
17
...4_Drawing_basics/C150_ComplexShapes002.kt → ...les/04_Drawing/C150_CurvesAndShapes004.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.