📜  在Python中使用 Arcade 绘制圆弧

📅  最后修改于: 2022-05-13 01:54:48.687000             🧑  作者: Mango

在Python中使用 Arcade 绘制圆弧

街机库是一个高科技Python包,其中包含一组先进的工具,用于制作具有抓人眼球的图形和声音的 2D 游戏。它是面向对象的,专为Python 3.6 及以上版本构建。

Arcade 有两个用于绘制圆弧的内置函数:

1:arcade.draw_arc_outline():这个函数用来画一个圆弧,对画曲线很有用

让我们看看下面的例子:-

Python3
import arcade
  
# Open the window. Set the window title and
# dimensions (width and height)
arcade.open_window(600, 600, "Draw  an arc  for GfG ")
  
arcade.set_background_color(arcade.color.WHITE)
  
# Start the render process.
arcade.start_render()
  
arcade.draw_arc_outline(150, 81, 15, 36,
                        arcade.color.BLACK, 90, 360)
  
arcade.finish_render()
  
arcade.run()


Python3
# import arcade module
import arcade
  
# Open the window. Set the window title and
# dimensions (width and height)
arcade.open_window(600, 600, "Draw  an arc  for GfG ")
  
# set a background color
arcade.set_background_color(arcade.color.WHITE)
  
# Start the render process.
arcade.start_render()
  
# function for drawing arc
arcade.draw_arc_filled(150, 144, 85, 86,
                       arcade.color.BOTTLE_GREEN, 90, 360, 45, 54)
  
# finished drawing
arcade.finish_render()
  
# to diaplay everything
arcade.run()


输出:

2: arcade.draw_arc_filled():这个函数用来绘制一个填充有颜色的圆弧,这对于绘制楔形或吃豆人很有用。

让我们举一个例子来清楚地了解功能。

蟒蛇3

# import arcade module
import arcade
  
# Open the window. Set the window title and
# dimensions (width and height)
arcade.open_window(600, 600, "Draw  an arc  for GfG ")
  
# set a background color
arcade.set_background_color(arcade.color.WHITE)
  
# Start the render process.
arcade.start_render()
  
# function for drawing arc
arcade.draw_arc_filled(150, 144, 85, 86,
                       arcade.color.BOTTLE_GREEN, 90, 360, 45, 54)
  
# finished drawing
arcade.finish_render()
  
# to diaplay everything
arcade.run()

输出: