mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-26 07:11:50 +01:00
https://youtu.be/G4MV9Q83zaY Add santa hats
This commit is contained in:
parent
b00c89906e
commit
8e0f385024
BIN
public/lightbar-images/santa.png
Normal file
BIN
public/lightbar-images/santa.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
@ -142,30 +142,44 @@ function ParticlesCanvas() {
|
|||||||
let imageParticleCount = particleCount;
|
let imageParticleCount = particleCount;
|
||||||
|
|
||||||
// Holiday overrides
|
// Holiday overrides
|
||||||
let imageOverride;
|
let imageOverride: { image: string; sizeRange?: [number, number] }[] = [];
|
||||||
let sizeRange;
|
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const month = date.getMonth();
|
const month = date.getMonth();
|
||||||
const day = date.getDate();
|
const day = date.getDate();
|
||||||
if (month === 11 && day >= 24 && day <= 26) {
|
if (month === 11 && day >= 12 && day <= 26) {
|
||||||
imageOverride = "/lightbar-images/snowflake.svg";
|
imageOverride = [
|
||||||
sizeRange = [4, 15] as [number, number];
|
{
|
||||||
|
image: "/lightbar-images/snowflake.svg",
|
||||||
|
sizeRange: [4, 15] as [number, number],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
image: "/lightbar-images/santa.png",
|
||||||
|
sizeRange: [15, 30] as [number, number],
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fish easter egg
|
// Fish easter egg
|
||||||
const shouldShowFishie = Math.floor(Math.random() * 600) === 1;
|
const shouldShowFishie = Math.floor(Math.random() * 600) === 1;
|
||||||
if (shouldShowFishie) {
|
if (shouldShowFishie) {
|
||||||
imageOverride = "/lightbar-images/fishie.png";
|
imageOverride = [
|
||||||
|
{
|
||||||
|
image: "/lightbar-images/fishie.png",
|
||||||
|
sizeRange: [10, 11] as [number, number],
|
||||||
|
},
|
||||||
|
];
|
||||||
imageParticleCount = particleCount / 2;
|
imageParticleCount = particleCount / 2;
|
||||||
sizeRange = [10, 11] as [number, number];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HOIST THE SAIL (of particles)!
|
// HOIST THE SAIL (of particles)!
|
||||||
for (let i = 0; i < particleCount; i += 1) {
|
for (let i = 0; i < particleCount; i += 1) {
|
||||||
const isImageParticle = imageOverride && i <= imageParticleCount;
|
const isImageParticle = imageOverride && i <= imageParticleCount;
|
||||||
|
const randomImageIndex = Math.floor(Math.random() * imageOverride.length);
|
||||||
|
const sizeRange = imageOverride[randomImageIndex]?.sizeRange;
|
||||||
|
const src = imageOverride[randomImageIndex]?.image;
|
||||||
const particle = new Particle(canvas, {
|
const particle = new Particle(canvas, {
|
||||||
imgSrc: isImageParticle ? imageOverride : undefined,
|
imgSrc: isImageParticle ? src : undefined,
|
||||||
horizontalMotion: imageOverride?.includes("fishie"),
|
horizontalMotion: src?.includes("fishie"),
|
||||||
sizeRange,
|
sizeRange,
|
||||||
});
|
});
|
||||||
particles.push(particle);
|
particles.push(particle);
|
||||||
|
Loading…
Reference in New Issue
Block a user