Random generator - Dice Roll with HTML5 canvas
What better than a dice to generate random numbers ?
However, it is not very easy to roll a dice even with HTML5 canvas !
Here is an essay which roll with drag and drop or touch and move...
But before trying to roll it like a real Dice, I'd like to solve the problem of its shape which appears with a coloured background (see this page).
Thank you for any comments or proposals.
Without perspective effect, It's possible to draw something that roll and look like a dice !
Next step, with perspective no more ellipses but many points...
If you wrote that code, then I am very impressed.
Unfortunately I am no good at 3D mathematics, or more advanced graphics in that case, to be of any help.
I will eagerly watch your progress though.
Thanks ! I wrote effectively that code...
Its' not very complicated to rotate a cube in space (see the source of 2x2x2 cube).
This Fascinating page give me the idea of this mini Rubik's cube. I intended to propose to solve each position (It's possible with 2x2x2 - See this page ) but it's to heavy with the canvas rolling cube.
My project is now simply to roll a dice... I discover now that Dices are not only cubes, but at first spheres...
EDIT : Opera and safari do not appreciate my last script.
Last edited by 007Julien; 11-10-2013 at 06:27 PM.
That looks really great. I am creating a Ludo game where I need a dice. Haven't done much 2D/3D coding myself. I will take your's as an example.
Originally Posted by 007Julien
How can I know which numbers are facing up?
Can anyone please tell me how to know which numbers are facing up?
How can I know which numbers are facing up after rolling is ended?
1. determine the results of the roll
Originally Posted by amanwas
2. display the animated roll
3. display the die with
the pre determined
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)