4 chapters
A bright ball of gas with a nuclear fusion producing a lot of heat.
How do we implement it?
More stars than the earth has sand grains ✨
1,000,000,000,000,000,000,000,000!
(one quadrillion)
in a pitch black night
Worse with light pollution
createSky({count: 250});
🎭 Idea: CSS animations for scale & opacity
up to 260.000 km/h
plus air friction =
@keyframes shootingStarOrbit {
0% { transform: translate(100px, 0) rotate(0); }
100% { transform: translate(100px, 0) rotate(180deg); }
}
.shooting-star {
animation: shootingStarOrbit 2s linear infinite;
}
@keyframes shootingStarOrbit {
0% {
transform: rotate(0) translate(100px, 0);
}
100% {
transform: rotate(180deg) translate(100px, 0);
}
}
@keyframes shootingStarOrbit {
100% {
transform:
rotate(180deg)
translate(var(--shooting-orbit-radius, 100px), 0);
}
}
// Provide values through JS
shootingStar.style.setProperty(
'--shooting-orbit-radius', value + 'px');
@keyframes shootingStarOrbit { 0% { transform: rotate(var(--shooting-orbit-angle-start, 0deg)) /*translate..*/ } 100% { transform: rotate(var(--shooting-orbit-angle, 180deg)) /* translate.. */ } }
shootingStar.style .setProperty('--shooting-orbit-angle-start', value + 'deg'); shootingStar.style .setProperty('--shooting-orbit-angle', value + 'deg');
createShootingStar({
x: 100, y: 100, radius: 100,
angleStart: -90, angle: -180
});
createShootingStar({
x: 100, y: 100, radius: 100,
angleStart: -90, angle: -180
});
4-6 per hour
Up to 200 shooting stars per hour
🎭Idea: Create multiple randomly shooting stars
.shooting-star { visibility: hidden; }
.shooting-star.is-shooting { visibility: visible; animation: shootingStarOrbit ... }
setInterval(() => shootNext(), 4000); function shootNext() { const shootingStar = nextStar(); shootingStar.classList.add('is-shooting'); lastStar.classList.remove('is-shooting'); lastStar = shootingStar; }
const points = [ {x: 0, y: 0}, {x: 100, y: 0}];
createDots(points);
createLine(points);
const lineHotpink = [0, 3, 1, 2];
// returns [{x:0. y:0}, {x:0. y:50}, ...]
const hotpinkPoints = indicesToPoints(lineHotpink, points);
createLine(hotpinkPoints);
function indicesToPoints(indices, sourceList) {
return indices.map(index => sourceList[index]);
}
const COORDINATES = [
{ x: 161, y: 352 },
{ x: 57, y: 365 },
{ x: 80, y: 273 },
// ...
];
const LINES = [
[7, 6, 5, 4, 3, 2, 7],
[5, 12],
[12, 14, 13],
[12, 15, 16, 17],
// ...
]
createConstellation(COORDINATES, LINES);
function createConstellation(points, multipleIndicesList) {
createDots(points);
// createStars(points)
multipleIndicesList.forEach(indices => {
const linePoints = indicesToPoint(indices, points);
createLine(linePoints);
})
}
.red-path {
--path-length: 100;
animation: revealPathAnimation 5s infinite backwards;
}
createStar({size: 10, color: 'red', x: 0, y: 0});
.twinkle-little-star {
animation:
starPulse 5s infinite alternate,
starGlowing 2s infinite alternate;
animation-delay: var(--animation-twinkle-delay, 0);
}
createShootingStar({
x: 100, y: 100, radius: 100,
angleStart: -90, angle: -180
});
createConstellation(points, linePoints);