Skip to content

dddice/dddice-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dddice JavaScript SDK

Integrate live 3D dice rolling into your own projects by leveraging the power of dddice.

Installation

Add to your project's dependencies using your favorite package manager.

npm install dddice-js --save
# or
yarn add dddice-js

Import and initialize the dddice instance.

import { ThreeDDice } from 'dddice-js'

const canvasElement = document.getElementById('dddice'); // get the canvas element to roll dice into
const dddice = new window.ThreeDDice(canvasElement, '<YOUR_API_KEY>');

dddice.start(); // start the renderer
dddice.connect('<YOUR_ROOM_SLUG>'); // connect and listen for room events

// Roll dice
dddice.roll([{
    theme: 'dddice-standard',
    type: 'd20',
}]);

Read the official documentation for usage information.

License

MIT