Difference between revisions of "love.graphics.arc (日本語)"

m (関数)
m (パックマンの描画)
Line 48: Line 48:
 
pacwidth = math.pi / 6 -- アイツの口の大きさ
 
pacwidth = math.pi / 6 -- アイツの口の大きさ
 
function love.draw( )
 
function love.draw( )
   love.graphics.setColor( 255, 255, 0 ) -- パックマンには黄色が必要だ
+
   love.graphics.setColor( 1, 1, 0 ) -- パックマンは黄色だ
 
   love.graphics.arc( "fill", 400, 300, 100, pacwidth, (math.pi * 2) - pacwidth )
 
   love.graphics.arc( "fill", 400, 300, 100, pacwidth, (math.pi * 2) - pacwidth )
 
end
 
end
 
</source>
 
</source>
 +
 
== 注釈 ==
 
== 注釈 ==
 
始点の角度が終点の角度より大きい数値の場合は円弧は反時計回り(左方向)に描画されます。終点の角度が始点の角度より大きい数値の場合は円弧は時計回り(右方向)に描画されます。
 
始点の角度が終点の角度より大きい数値の場合は円弧は反時計回り(左方向)に描画されます。終点の角度が始点の角度より大きい数値の場合は円弧は時計回り(右方向)に描画されます。

Revision as of 11:46, 17 October 2019

LÖVE 0.8.0 から使用可能
この関数は以前のバージョンでは非対応です。

塗り潰しまたは中抜きの円弧を (x, y) 座標へ描画します。円弧は angle1 から angle2 へ 弧度(ラジアン)単位を用いて描画されます。 引数 segments (セグメント) は円弧を描画するために使用する線分の数を決定します。線分を多くすると、角が滑らかな曲線になります。

関数

"pie" 型の ArcType を使用して円弧を描画します。

概要

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

引数

DrawMode drawmode
円弧の描画方法。
number x
中心からの x-軸座標。
number y
中心からの y-軸座標。
number radius
円弧の半径。
number angle1
円弧における始点の角度。
number angle2
円弧における終点の角度。
number segments (10)
円弧を描画するために使用する線分の数。

返値

ありません。

関数

LÖVE 0.10.1 から使用可能
この異形は以前のバージョンでは非対応です。

概要

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

引数

DrawMode drawmode
円弧の描画方法。
ArcType arctype
描画で使用する円弧の種類。
number x
中心からの x-軸座標。
number y
中心からの y-軸座標。
number radius
円弧の半径。
number angle1
円弧における始点の角度。
number angle2
円弧における終点の角度。
number segments (10)
円弧を描画するために使用する線分の数。

返値

ありません。

用例

半円の描画

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

パックマンの描画

pacwidth = math.pi / 6 -- アイツの口の大きさ
function love.draw( )
  love.graphics.setColor( 1, 1, 0 ) -- パックマンは黄色だ
  love.graphics.arc( "fill", 400, 300, 100, pacwidth, (math.pi * 2) - pacwidth )
end

注釈

始点の角度が終点の角度より大きい数値の場合は円弧は反時計回り(左方向)に描画されます。終点の角度が始点の角度より大きい数値の場合は円弧は時計回り(右方向)に描画されます。

関連



そのほかの言語