Skip to content

Tiny Dice adds a sprinkle of fun and a touch of magic to your dice-rolling adventures โ€” fully customizable with CSS and JavaScript to match your style, theme, or imagination! ๐ŸŽฒโœจ

License

Notifications You must be signed in to change notification settings

Tiny-Essentials/Tiny-Dices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

73 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

banner

Discord server NPM version NPM downloads Patreon Ko-Fi

npm installnfo

๐ŸŽฒ Tiny Dices - Fun 3D Dice Rolling with JavaScript

Welcome to Tiny Dices! This JavaScript library is here to bring an extra layer of fun and magic to your dice-rolling experience. โœจ Whether you're rolling for your favorite tabletop RPG or just need some virtual dice to shake things up, TinyDices makes it all possible with style!

Inspiration โœจ

This project was initially a custom dice application from Pony Driland repository. The tiny dice eventually evolved during the development that resulted in this project that is now published by the same creator of the Pony Driland repository.

Features ๐ŸŒŸ

  • Roll any number of dice โ€“ from a single die to a whole set of them! ๐ŸŽฒ
  • Customizable max values โ€“ set different max values for each die. ๐ŸŒˆ
  • Spinning animation โ€“ your dice can spin infinitely or stop after a cool animation. ๐Ÿ”„
  • Dynamic cube generation โ€“ each die is a rotating, animated cube with unique faces. ๐ŸŽญ
  • Zero-inclusive rolls โ€“ make 0 a valid result if you need it! (Optional) ๐Ÿฅณ

How to Use ๐ŸŒŸ

  1. Create a Dice Instance:

    const container = document.getElementById('myDice');
    const dice = new TinyDices(container);
  2. Roll Some Dice:

  • ๐ŸŽฒ Roll 3 six-sided dice:

    dice.roll('7,7,7'); // Rolls 3d7 ๐ŸŽฒ๐ŸŽฒ๐ŸŽฒ
  • ๐ŸŽฏ Roll a mix of dice:

    dice.roll('6,12,20'); // Rolls d6, d12, and d20 ๐Ÿ”ข๐ŸŽฒ
  • ๐Ÿ”„ Roll with infinite spinning animation:

    dice.roll([10, 10], false, true); // Rolls 2d10 with infinite spin ๐Ÿ”„๐ŸŽฒ
  • ๐Ÿงฎ Roll with values starting from 0:

    dice.roll([10, 10], true); // Rolls 2d10 starting from 0 ๐Ÿฅณ๐ŸŽฒ
  • ๐Ÿงช Roll a custom set of dice with zero and infinity:md-assets/tiny-crypto-suite.jpg

    dice.roll([4, 8, 6], true, true); // Rolls d4, d8, and d6 from 0 with infinite spin โš™๏ธ๐ŸŽฒ

Customization ๐ŸŽจ

Feel free to customize the appearance of your dice with different skins:

  • Background Skin: Set a cool background with solid colors like 'gray', 'blue', or 'green', or something magical! โœจ

    dice.setBgSkin('gray'); // Sets background skin to gray ๐ŸŒซ๏ธ
  • Text Skin: Make your dice text stand out with solid color skins like 'red', 'yellow', or 'white'! ๐ŸŒŸ

    dice.setTextSkin('red'); // Makes the text red ๐Ÿ”ด
  • Border Skin: Add a border effect to your dice with colors like 'black', 'orange', or 'purple'! โœจ

    dice.setBorderSkin('2px solid black'); // Sets a black border โšซ
  • Get Current Skins: Check what skins you're using right now:

    dice.getBgSkin(); // Returns current background skin ๐ŸŽจ
    dice.getTextSkin(); // Returns current text skin ๐Ÿ–‹๏ธ
    dice.getBorderSkin(); // Returns current border skin โšก

๐Ÿ’ป How It Works

Tiny Dices works by creating a customizable, 3D cube with 6 animated faces. Every time you roll, the faces spin and reveal random numbers. ๐ŸŽฒโœจ

  • The front face shows the result of your roll ๐Ÿฅณ
  • The other faces are randomized, creating a truly unique dice experience!

You can also customize the cube's animation. Want it to spin forever? Or just do a quick 360? ๐ŸŽก


๐ŸŽจ Styles & Animations

Tiny Dices comes with cool animation effects and customizable styles. From spin effects to face transformations, the dice will roll in style. โœจ

  • Spin it Infinite!: Watch the dice spin forever for an endless feeling of anticipation! ๐Ÿ”„
  • Spin it Custom: You can control how the dice rotate with custom animations. Rotate along different axes for the coolest effects! ๐Ÿ”ฎ

๐Ÿšจ Don't Forget

Remember to check out the Tiny Dices Docs for more detailed instructions and advanced features! ๐Ÿ“


๐Ÿ“ฃ Credits

This project was created by Yasmin Seidel (JasminDreasond) with some extra help from ChatGPT. Tiny thanks to everyone contributing to the open-source community! ๐Ÿ’–


License ๐Ÿ“œ

This project is licensed under the GPL-3.0 License โ€“ feel free to use and customize it for your own projects! ๐Ÿ› ๏ธ


๐Ÿš€ Let's roll those tiny dice! ๐ŸŽฒ


๐Ÿ”™ Back to Tiny Essentials

Did you like this module? Itโ€™s part of the Tiny Essentials collection โ€” a set of minimal yet powerful tools to make development easier. ๐Ÿ‘‰ Click here to explore more Tiny Essentials modules



Made with tiny love!

About

Tiny Dice adds a sprinkle of fun and a touch of magic to your dice-rolling adventures โ€” fully customizable with CSS and JavaScript to match your style, theme, or imagination! ๐ŸŽฒโœจ

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

Contributors 2

  •  
  •