mirror of
https://github.com/dmuth/diceware.git
synced 2024-11-23 17:26:34 -05:00
Started reducing the delay of subsequent dice rolls. It speeds up the rolling of 8 dice.
This commit is contained in:
parent
3bf6c46df7
commit
84d77e3901
1 changed files with 14 additions and 5 deletions
19
main.js
19
main.js
|
@ -93,13 +93,14 @@ jQuery(".dice_button").on("click", function(e) {
|
|||
*
|
||||
* @param array rows Array of rows of dice rolls that we had.
|
||||
* @param object cb Our callback to fire when done
|
||||
* @param integer in_fadein_duration How long before fading in a roll of dice
|
||||
* @param integer in_fadeout_delay How long before fading out the diceroll
|
||||
*
|
||||
*/
|
||||
function display_row(rows, cb) {
|
||||
function display_row(rows, cb, in_fadein_duration, in_fadeout_delay) {
|
||||
|
||||
var fadein_duration = 250;
|
||||
var fadeout_delay = 750;
|
||||
console.log(rows.length, fadein_duration, fadeout_delay);
|
||||
var fadein_duration = in_fadein_duration || 250;
|
||||
var fadeout_delay = in_fadeout_delay || 750;
|
||||
|
||||
if (rows.length) {
|
||||
//
|
||||
|
@ -125,13 +126,21 @@ console.log(rows.length, fadein_duration, fadeout_delay);
|
|||
|
||||
});
|
||||
|
||||
//
|
||||
// Decrease the delays with subsequent rolls so that users
|
||||
// don't get impatent.
|
||||
// (I know I did when rolling 8 dice!)
|
||||
//
|
||||
fadein_duration -= 25;
|
||||
fadeout_delay -= 50;
|
||||
|
||||
//
|
||||
// Now fade out the entire row, and call ourselves again
|
||||
// so we can repeat with the next row.
|
||||
//
|
||||
jQuery(this).delay(fadeout_delay)
|
||||
.fadeOut(fadeout_delay, function() {
|
||||
display_row(rows, cb);
|
||||
display_row(rows, cb, fadein_duration, fadeout_delay);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue