react-pong
v1.1.1
Published
A react ping pong game component
Downloads
13
Maintainers
Readme
react-pong
A simple ping-pong game as a React component composed in ES6.
Inspired by Max Wihlborg
Add to your project:
npm install --save react-pong
Usage:
import Pong from 'react-pong';
React.render(
<Pong/>,
document.getElementById('container')
);
Properties/API:
height
- Number - Height of canvas element in px - default: 600width
- Number - Width of canvas element in px - default: 700,upArrow
- Number - Keyboard code for moving paddle in up direction - default: 38downArrow
- Number - Keyboard code for moving paddle in down direction - default: 40ballSize
- Number - Diameter of ball in pixels - default: 10paddleHeight
- Number - Height of both paddles in pixels - default: 100paddleWidth
- Number - Thickness of both paddles in pixels - default: 20paddleSpeed
- Number - Number of pixels moved by player paddle on key press - default: 5