is a canvas to play tic tac toe in 3d
Installation | API | License
With npm do
npm install three tris3d-canvas
Note that three.js is required as a peer dependency.
See online example or do the following to run example.js
npm install
npm start
Constructor to create an instance of Tris3dCanvas.
Create a canvas with attribute id
, inside a div container with display: block
style
<div style="display: block">
<canvas id="demo"></canvas>
</div>
Then create a Tris3dCanvas object
const tris3dCanvas = new Tris3dCanvas('demo')
Optional parameters are accepted after canvasId
, constructor signature
is the following:
- @param
{String}
id of canvas element - @param
{Object}
[opt] optional parameters - @param
{Array}
[opt.playerColors] are three colors, like 0xff0000 - @param
{Array}
[opt.backgroundColor] defaults to 0xffffff
Can be 0, 1, 2. Defaults to 0, which means the local player moves first.
Listen to localPlayerTurnEnds event.
Listen to localPlayerTurnStarts event.
Listen to nextPlayer event.
Listen to nobodyWins event.
Listen to setChoice event.
Listen to tris3d! event.
Start rendering the 3d scene.
Set player choice.
Reset playground without start playing a new match.
Start a brand new match