Roll A Die
Simple 3D dice roll animator by CSS3 Animation.
Vanilla JS
Copy dist/roll-a-die.js into your library folder
Load it into your HTML script
<script type="text/javascript" src="path/to/roll-a-die.js"></script>
Call the method with its options.
rollDice({ element, numberDice: 2, callback});
With npm (and CommonJS builder)
Install with npm.
npm install --save roll-a-die
Call method
const rollDice = require('roll-a-die');
rollDice({ element, numberDice: 2, callback});
rollDice({ element, numberDice: 2, callback, noSound: true});
Definitions
element
: The element to render die animation on.numberDice
: The number of dice to use.`callback
: Called when animation is finished. Returns an array of the values from throw.noSound
: Roll the die without sound.
Thanks
License
MIT License