claw-machine-js
Version:
A physics based claw-machine simulation
36 lines (35 loc) • 1.77 kB
TypeScript
import { IBall } from '../interfaces/Ball.ts';
import { ICollisionPoints } from '../interfaces/ICollisionPoints.ts';
/**
* Draws the claw on the given canvas context.
*
* @param clawWidth - size of the claw
* @param context - The canvas rendering context.
* @param collisionPoints - Objects, that hold all points to draw the Claw
* @param clawColor - Color of the claw
* @param clawBoltColor - Color of the Bolt inside the claw
*/
export declare function drawClaw(clawWidth: number, context: CanvasRenderingContext2D, collisionPoints: ICollisionPoints, clawColor: string, clawBoltColor: string): void;
/**
* Draws the divider line on the given canvas context.
*
* @param context - The canvas rendering context.
* @param dividerLineWidth - Width of the divider Line.
* @param dividerLineHeight - Height of the divider Line.
* @param collisionPoints - Objects, that hold all points to draw the dividerLine
* @param dividerLineFillColor - Fill Color of the divider
* @param dividerLineBorderColor - Border Color of the divider itself
*/
export declare function drawDividerLine(context: CanvasRenderingContext2D, dividerLineWidth: number, dividerLineHeight: number, collisionPoints: ICollisionPoints, dividerLineFillColor: string, dividerLineBorderColor: string): void;
/**
* creates the imageCache by loading all images so they do not have to be loaded from scratch on every rerender
* @param balls initial Balls array with icon paths
*/
export declare function preloadImagesForBalls(balls: IBall[]): Promise<void>;
/**
* Draws the ball on the given canvas context.
*
* @param context - The canvas rendering context.
* @param ball - The current ball to draw.
*/
export declare function drawBall(context: CanvasRenderingContext2D, ball: IBall): void;