dddice-js
v0.19.16
Published
Integrate live 3D dice rolling into your own projects by leveraging the power of [dddice](https://dddice.com).
Downloads
130
Readme
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