Surface.gradientLine
From Spheriki
Draw a line on the surface. The line's color will go from one color on the starting point to a different color at the ending point.
Usage
- surface Sphere Surface object. The surface to draw the line on.
- x1, y1 numbers. Coordinates of the top-left of the line, in pixels.
- x2, y2 numbers. Coordinates of the bottom-right of the line, in pixels.
- param1 description
- color1 Sphere Color object. Determines the gradient start color.
- color2 Sphere Color object. Determines the gradient end color.
Examples
Draw two diagonal lines from the top-left to the bottom-right of the surface, and the top-right to the bottom-left of the surface. The top-left line fades to black, the top-right line fades to white.
var red = CreateColor(255,0,0); var green = CreateColor(0,255,0); var black = CreateColor(0,0,0); var white = CreateColor(255,255,255); var s = CreateSurface(320, 240, black); s.line(0, 0, 320, 240, red, black); //Top-left to bottom-right s.line(320, 0, 0, 240, green, white); //Top-right to bottom-left
See also
- Sphere Surface object
- Sphere Color object
- CreateSurface()
- CreateColor()