Use specific confetti colors

This commit is contained in:
Joshua Seigler 2017-08-24 16:49:42 -04:00
parent 4fd2ed688b
commit 8151b6a3a9

View file

@ -4,6 +4,15 @@
'use strict'; 'use strict';
var DEFAULT_NUM_CONFETTI = 500, var DEFAULT_NUM_CONFETTI = 500,
CONFETTI_COLORS = [
"white",
"purple",
"#D12D23",
"#C1141A",
"#DD7512",
"#EAA813",
"#1BA58E"
],
animate = window.requestAnimationFrame || animate = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame || window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame || window.mozRequestAnimationFrame ||
@ -87,9 +96,10 @@
}; };
function color() { function color() {
return 'rgba(' + randomFrom(0, 256) + ', ' + // return 'rgba(' + randomFrom(0, 256) + ', ' +
randomFrom(0, 256) + ', ' + // randomFrom(0, 256) + ', ' +
randomFrom(0, 256) + ', ' + Math.random() + ')'; // randomFrom(0, 256) + ', ' + Math.random() + ')';
return CONFETTI_COLORS[randomFrom(0,CONFETTI_COLORS.length)];
} }
function randomFrom(a, b, factor) { function randomFrom(a, b, factor) {