Difference between revisions of "PixelDisplay.line"

From MiniScript Wiki
Jump to navigation Jump to search
(Created page with "<c>PixelDisplay.line</c> draws a line on the pixel display. === Arguments === {| class="wikitable" |- ! Parameter Name !! Type !! Default Value !! Meaning |- | ''x1'' ||...")
 
(added an example)
 
Line 17: Line 17:
 
| ''color'' || color || self.color || color to draw
 
| ''color'' || color || self.color || color to draw
 
|-
 
|-
| ''penSize'' || number || 640 || width of line to draw
+
| ''penSize'' || number || 1 || width of line to draw
 
|}  
 
|}  
  
 
== Example ==
 
== Example ==
 +
A simple line using the current default [[PixelDisplay.color|color]], and a pen size of 1:
 +
<ms>gfx.line 100,200, 500,200</ms>
  
<ms>gfx.line 100,200, 500,200</ms>
+
The following draws a series of yellow lines of increasing thickness:
 +
<ms>for x in range(0, 960, 50)
 +
gfx.line 0,0, x,640, color.yellow, x/50
 +
end for</ms>
  
 
[[Category:Mini Micro]]
 
[[Category:Mini Micro]]

Latest revision as of 21:23, 10 June 2021

PixelDisplay.line draws a line on the pixel display.

Arguments

Parameter Name Type Default Value Meaning
x1 number 0 horizontal position of one end of the line
y1 number 0 vertical position of one end of the line
x2 number 960 horizontal position of other end of the line
y2 number 640 vertical position of other end of the line
color color self.color color to draw
penSize number 1 width of line to draw

Example

A simple line using the current default color, and a pen size of 1:

gfx.line 100,200, 500,200

The following draws a series of yellow lines of increasing thickness:

for x in range(0, 960, 50)
	gfx.line 0,0, x,640, color.yellow, x/50
end for