Difference between revisions of "love.graphics.arc"

Line 17: Line 17:
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
== Examples ==
 +
=== Drawing half a circle ===
 +
<source lang="lua">
 +
function love.draw( )
 +
  love.graphics.arc( "fill", 400, 300, 100, 0, math.pi)
 +
end
 +
</source>
 +
=== Drawing Pacman ===
 +
<source lang="lua">
 +
pacwidth = math.pi / 6 -- size of his mouth
 +
function love.draw( )
 +
  love.graphics.setColor(255, 255, 0) -- pacman needs to be yellow
 +
  love.graphics.arc( "fill", 400, 300, 100, pacwidth, (math.pi * 2) - pacwidth)
 +
end
 +
</source>
 
== See Also ==
 
== See Also ==
 
* [[parent::love.graphics]]
 
* [[parent::love.graphics]]

Revision as of 15:22, 6 February 2012

Available since LÖVE 0.8.0
This function is not supported in earlier versions.

Draws an arc.

Function

Synopsis

love.graphics.arc( mode, x, y, radius, angle1, angle2, segments )

Arguments

DrawMode mode
How to draw the arc.
number x
The position of the center along x-axis.
number y
The position of the center along y-axis.
number radius
Radius of the arc.
number angle1
The angle at which the arc begins.
number angle2
The angle at which the arc terminates.
number segments (10)
The number of segments used for drawing the arc.

Returns

Nothing.

Examples

Drawing half a circle

function love.draw( )
  love.graphics.arc( "fill", 400, 300, 100, 0, math.pi)
end

Drawing Pacman

pacwidth = math.pi / 6 -- size of his mouth
function love.draw( )
  love.graphics.setColor(255, 255, 0) -- pacman needs to be yellow
  love.graphics.arc( "fill", 400, 300, 100, pacwidth, (math.pi * 2) - pacwidth)
end

See Also

Other Languages