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.
Properties:
Name Type Description
r Number The radius of the ball.
x Number The x-position of the ball.
y Number The y-position of the ball.
vx Number The vx-velocity of the ball.
vy Number The vy-velocity of the ball.
rInit Number | Array The initial radius of the ball.
xInit Number | Array The initial x-position of the ball.
yInit Number | Array The initial y-position of the ball.
vxInit Number | Array The initial vx-velocity of the ball.
vyInit Number | Array The initial vy-velocity of the ball.
borderWidth int The width of the border of the ball.
borderColor String The color of the border of the ball.
color String The color of the ball.
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 Tue Nov 12 2013 11:29:08 GMT+0100 (MEZ) using the DocStrap template.