mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-14 09:34:10 -08:00
4356cb7b9b
Signed-off-by: snipe <snipe@snipe.net>
25 lines
877 B
PHP
25 lines
877 B
PHP
@if (auth()->user() && auth()->user()->enable_confetti=='1')
|
|
<script>
|
|
var duration = 1500;
|
|
var animationEnd = Date.now() + duration;
|
|
var defaults = { startVelocity: 30, spread: 360, ticks: 60, zIndex: 0 };
|
|
|
|
function randomInRange(min, max) {
|
|
return Math.random() * (max - min) + min;
|
|
}
|
|
|
|
var interval = setInterval(function() {
|
|
var timeLeft = animationEnd - Date.now();
|
|
|
|
if (timeLeft <= 0) {
|
|
return clearInterval(interval);
|
|
}
|
|
|
|
var particleCount = 50 * (timeLeft / duration);
|
|
// since particles fall down, start a bit higher than random
|
|
confetti({ ...defaults, particleCount, origin: { x: randomInRange(0.1, 0.3), y: Math.random() - 0.2 } });
|
|
confetti({ ...defaults, particleCount, origin: { x: randomInRange(0.7, 0.9), y: Math.random() - 0.2 } });
|
|
}, 250);
|
|
|
|
</script>
|
|
@endif |