Skip to content
Kyuchumimo edited this page Mar 18, 2022 · 8 revisions

elli

elli x y a b color

Parameters

  • x, y : the coordinates of the ellipse's center
  • a : the horizontal radius of the ellipse in pixels
  • b : the vertical radius of the ellipse in pixels
  • color: the index of the desired color in the current palette

Description

This function draws a filled ellipse of the desired radiuses a b and color with its center at x, y.

See also:

  • ellib - draw only the boundary of the ellipse

Example

#####################################

# title:  ellipse example
# author: paul59, edited by Kyuchumimo
# script: python

CX,CY=120,68
RED,GREEN=2,6
MIN,MAX=8,48

hrad,vrad=16,16

while True:

    if btn(0) and vrad<MAX: vrad=vrad+1
    if btn(1) and vrad>MIN: vrad=vrad-1
    if btn(2) and hrad<MAX: hrad=hrad+1
    if btn(3) and hrad>MIN: hrad=hrad-1

    cls(0)
    print('Use the cursor keys to adjust size',24,2)
    #draw filled ellipse
    elli(CX,CY,hrad,vrad,RED)
    #draw outline ellipse
    #swap the horizontal and vertical radii
    ellib(CX,CY,vrad,hrad,GREEN)

#####################################

Clone this wiki locally