// Under a shell type: box -l g gradient.box
// ---
// Here we test the gradient capabilities inherited from Cairo.
include "g"
// Define a linear and radial gradient
g1 = Gradient[.Line[(-25, -25), (0, 0)], color.red, color.yellow]
g2 = Gradient[.Circle[(10, 5), 0; 12], color.white, color.black]
ball = Window[][\ .Circle[g2, (10, 5), 12]]
w = Window[][
\ .Poly[g1, (-25, -25), (25, -25), (25, 25), (-25, 25)]
\ .Put[ball] // Just put the ball Window
\ .Put[ball, (-15, -10), .Scale[(0.2, 0.5)], const.pi*0.25] // Scale and rotate
.Save["gradient.png"]
]
|