Class: Ball

$wk$. Ball

new Ball(p_context, p_init)

This:
Parameters:
Name Type Description
p_context CanvasRenderingContext2D The 2d context of the canvas upon which the ball is to be drawn.
p_init Object An object that contains initialization values for the attributes rInit, xInit, yInit, vxInit, vyInit, borderWidth, borderColor, and color.
Source:

Members

borderColor :String

The color of the border of the ball.
Type:
  • String
Source:

borderWidth :Number

The width of the border of the ball.
Type:
  • Number
Source:

color :String

The color of the ball.
Type:
  • String
Source:

r :Number

The radius of the ball.
Type:
  • Number
Source:

rInit :Number

The initial radius of the ball.
Type:
  • Number
Source:

vx :Number

The x-velocity of the ball.
Type:
  • Number
Source:

vxInit :Number

The initial x-velocity of the ball.
Type:
  • Number
Source:

vy :Number

The y-velocity of the ball.
Type:
  • Number
Source:

vyInit :Number

The initial y-velocity of the ball.
Type:
  • Number
Source:

x :Number

The x-position of the ball.
Type:
  • Number
Source:

xInit :Number

The initial x-position of the ball.
Type:
  • Number
Source:

y :Number

The y-position of the ball.
Type:
  • Number
Source:

yInit :Number

The initial y-position of the ball.
Type:
  • Number
Source:

Methods

draw()

Draws the ball at its current position onto a 2d context.
Source:

move(p_delta_t)

Moves the ball in direction (vx,vy); the step size depends on FPS.
Parameters:
Name Type Description
p_delta_t Number The time elapsed since the last call of move.
Source:

reset()

Resets the ball: Moves the ball to its starting position and computes randomly a velocity vector.
Source:
W. Kowarschick © 2013 (CC BY-NC-SA 3.0: http://creativecommons.org/licenses/by-nc-sa/3.0/)
Documentation generated by JSDoc 3.3.0-dev on Sat Nov 16 2013 10:53:54 GMT+0100 (MEZ) using the DocStrap template.