mirror of
https://github.com/aNNiMON/Own-Programming-Language-Tutorial.git
synced 2024-09-20 08:44:20 +03:00
24 lines
667 B
Scala
24 lines
667 B
Scala
use "canvasfx"
|
|
use "std"
|
|
|
|
// http://www.developer.com/java/data/using-graphics-in-javafx.html
|
|
|
|
width = 800 height = 600
|
|
g = window("JavaFX Rotation example", width, height)
|
|
|
|
g.translate(width / 2, height / 2)
|
|
|
|
def randomColor() = Color.rgb(rand(255), rand(255), rand(255), 0.9)
|
|
|
|
for i = 0, i < 60, i++ {
|
|
g.rotate(6.0)
|
|
g.setFill(randomColor())
|
|
g.fillOval(10, 60, 30, 30)
|
|
g.setStroke(randomColor())
|
|
g.strokeOval(60, 60, 30, 30)
|
|
g.setFill(randomColor())
|
|
g.fillRoundRect(110, 60, 30, 30, 10, 10)
|
|
g.setFill(randomColor())
|
|
g.fillPolygon([105, 117, 159, 123, 133, 105, 77, 87, 51, 93],
|
|
[150, 186, 186, 204, 246, 222, 246, 204, 186, 186], 10)
|
|
} |