Linear and radial color gradients
// 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[Circles[(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) // Translate...
Scale[(0.2, 0.5)] // Scale and...
Angle[const.pi*0.25]] // rotate
]
w.Save["gradient.png"]