Cosmic animations for the modern web
Neutron star pulse animation
Event horizon and accretion disk
Space-time tunnel effect
Stellar explosion effect
Dynamic space debris
High-energy particle effect
Small celestial body
Interstellar cloud formation
Dual star system
Interstellar particles
Relativistic time effect
Quantum mechanical effect
Cosmic microwave background
Space-time ripples
Invisible mass effect
Charged particle stream
Topological defects
Black hole evaporation
Rapid universe expansion
Parallel universes
Ultra-dense stellar remnant
Active galactic nucleus
Mysterious expansion force
Echo of the Big Bang
Light bending by gravity
Einstein's warped space
Spooky action at a distance
High-energy particle explosion
Solar magnetic explosion
Celestial collision event
Majestic cosmic whirlpool
Spacetime whirlpool
Birthplace of stars
Subatomic reality
Cosmic scaffolding
Cosmic gold factory
Space weather
Warp speed journey
Cosmic dance of death
Music of the spheres
Include GalaxyJS in your project:
<script src="js/main.js"></script>
<script src="js/animations.js"></script>
<link rel="stylesheet" href="css/animations.css">
Or install via npm:
npm install galaxyjs
# or
yarn add galaxyjs
Initialize GalaxyJS and create animations:
// Initialize GalaxyJS
const galaxy = new GalaxyJS({
debug: true,
autoInit: true
});
// Create a pulsar animation
galaxy.animations.initPulsar('.pulsar-element', {
frequency: 2,
intensity: 0.8
});
// Create a black hole animation
galaxy.animations.initBlackHole('.blackhole-element', {
eventHorizon: true,
accretionDisk: true
});
new GalaxyJS(options)
Options:
debug (boolean): Enable debug loggingautoInit (boolean): Auto-initialize on DOM readyparticleCount (number): Default particle counttrailLength (number): Mouse trail lengthAll animation methods follow this pattern:
galaxy.animations.init[AnimationName](element, options)
galaxy.animations.initPulsar(element, {
frequency: 2, // Hz
intensity: 0.8, // 0-1
waveCount: 3, // Number of waves
color: '#ffffff' // Wave color
});
galaxy.animations.initBlackHole(element, {
eventHorizon: true, // Show event horizon
accretionDisk: true, // Show accretion disk
rotationSpeed: 0.02, // Rotation speed
diskParticles: 50 // Number of particles
});
galaxy.animations.initNeutronStar(element, {
rotationSpeed: 0.02, // Core rotation speed
magneticField: true, // Show magnetic field
pulsarBeams: true // Show pulsar beams
});
galaxy.animations.initSupernova(element, {
explosionForce: 100, // Explosion intensity
particleCount: 30, // Number of particles
duration: 3000 // Animation duration (ms)
});
galaxy.animations.initBinaryStars(element, {
orbitSpeed: 0.01, // Orbital speed
starSize: 12, // Star size (px)
orbitRadius: 30 // Orbit radius (px)
});
galaxy.animations.initSolarFlare(element, {
flareIntensity: 0.7, // Flare intensity
plasmaArcCount: 4, // Number of plasma arcs
eruptionSpeed: 0.03 // Eruption speed
});
galaxy.animations.initWormhole(element, {
depth: 200, // Tunnel depth
starCount: 20, // Number of stars
tunnelSpeed: 0.05 // Travel speed
});
galaxy.animations.initQuasar(element, {
accretionDiskSpeed: 0.03, // Disk rotation speed
jetStreamIntensity: 0.8, // Jet stream intensity
energyBurstRate: 0.1 // Burst frequency
});
galaxy.animations.initNebula(element, {
particleCount: 30, // Number of particles
cloudSize: 80, // Cloud size (px)
driftSpeed: 0.01 // Particle drift speed
});
galaxy.animations.initAsteroidField(element, {
asteroidCount: 15, // Number of asteroids
fieldSize: 200, // Field size (px)
rotationSpeed: 0.01 // Rotation speed
});
galaxy.animations.initAsteroidImpact(element, {
impactForce: 0.8, // Impact intensity
debrisCount: 10, // Number of debris pieces
craterSize: 0.6 // Crater size multiplier
});
galaxy.animations.initCosmicRay(element, {
rayCount: 5, // Number of rays
speed: 2, // Ray speed
length: 50 // Ray length (px)
});
galaxy.animations.initCosmicRayBurst(element, {
burstRate: 0.1, // Burst frequency
rayCount: 8, // Number of rays
energyWaveSpeed: 0.02 // Wave propagation speed
});
galaxy.animations.initSolarWind(element, {
particleCount: 20, // Number of particles
windSpeed: 3, // Wind speed
magneticField: true // Show magnetic field
});
galaxy.animations.initCosmicDust(element, {
particleCount: 50, // Number of particles
driftSpeed: 0.005, // Drift speed
particleSize: 1 // Particle size (px)
});
galaxy.animations.initCosmicStrings(element, {
stringCount: 3, // Number of strings
vibrationSpeed: 0.02, // Vibration speed
stringLength: 60 // String length (px)
});
galaxy.animations.initQuantumTunneling(element, {
barrierHeight: 50, // Energy barrier height
particleSpeed: 2, // Particle speed
tunnelProbability: 0.3 // Tunneling probability
});
galaxy.animations.initQuantumEntanglement(element, {
entanglementStrength: 0.8, // Entanglement strength
particleSpinSpeed: 0.02, // Spin speed
fieldRadius: 30 // Field radius (px)
});
galaxy.animations.initHawkingRadiation(element, {
radiationRate: 5, // Radiation frequency
particleEnergy: 2, // Particle energy
evaporationSpeed: 0.01 // Evaporation speed
});
galaxy.animations.initTimeDilation(element, {
dilationFactor: 0.5, // Time dilation factor
clockSpeed: 0.01 // Clock tick speed
});
galaxy.animations.initGravitationalLensing(element, {
lensMass: 0.8, // Lens mass strength
lightRayCount: 5, // Number of light rays
distortionStrength: 0.5 // Distortion intensity
});
galaxy.animations.initSpacetimeCurvature(element, {
massStrength: 0.6, // Mass effect strength
fabricGridSize: 20, // Grid size (px)
curvatureWaves: true // Show curvature waves
});
galaxy.animations.initGravitationalWaves(element, {
waveCount: 3, // Number of waves
waveSpeed: 2, // Wave propagation speed
amplitude: 20 // Wave amplitude (px)
});
galaxy.animations.initDarkMatter(element, {
fieldStrength: 0.5, // Field strength
fieldRadius: 80, // Field radius (px)
visibleMatterOpacity: 0.5 // Visible matter opacity
});
galaxy.animations.initDarkEnergy(element, {
expansionRate: 0.005, // Expansion rate
fieldStrength: 0.6, // Field strength
particleCount: 20 // Number of particles
});
galaxy.animations.initCosmicMicrowave(element, {
patternSpeed: 0.001, // Pattern rotation speed
temperatureVariations: true, // Show temperature variations
noiseLevel: 0.1 // Background noise level
});
galaxy.animations.initCosmicInflation(element, {
expansionRate: 0.1, // Expansion rate
fieldStrength: 0.8, // Field strength
duration: 6000 // Animation duration (ms)
});
galaxy.animations.initMultiverse(element, {
universeCount: 3, // Number of universes
bubbleSize: 40, // Bubble size (px)
expansionSpeed: 0.01 // Expansion speed
});
galaxy.animations.initNeutronStar(element, {
pulseRate: 0.02, // Pulse rate
brightness: 0.9, // Star brightness
color: '#CCE0FF' // Star color
});
galaxy.animations.initQuasar(element, {
coreSize: 15, // Core size (px)
jetLength: 60, // Jet length (px)
jetSpeed: 2, // Jet animation speed
brightness: 1.0 // Core brightness
});
galaxy.animations.initSpiralGalaxy(element, {
numArms: 4, // Number of spiral arms
numStars: 200, // Number of stars
rotationSpeed: 0.01, // Rotation speed
spiralTightness: 0.25 // How tight the spiral is
});
galaxy.animations.initCosmicVortex(element, {
particleCount: 20, // Number of particles
vortexSpeed: 0.05, // Rotation speed
radius: 35, // Vortex radius
color: '#C864FF' // Particle color
});
galaxy.animations.initStellarNursery(element, {
cloudCount: 5, // Number of gas clouds
formingStars: true, // Show forming stars
cloudSize: 40, // Cloud size (px)
color: 'hsl(280, 60%, 50%)' // Cloud color
});
galaxy.animations.initQuantumField(element, {
gridSize: 5, // Grid size (5x5)
fluctuationSpeed: 0.05, // Fluctuation speed
intensity: 0.8, // Field intensity
color: '#9664FF' // Field color
});
galaxy.animations.initDarkMatterWeb(element, {
nodeCount: 8, // Number of nodes
connections: 2, // Connections per node
webRadius: 35, // Web radius (%)
color: '#643296' // Web color
});
galaxy.animations.initNeutronStarCollision(element, {
collisionSpeed: 0.5, // Approach speed
explosionSize: 60, // Explosion radius
particleCount: 16, // Debris particles
cycleTime: 5000 // Time per cycle (ms)
});
galaxy.animations.initCosmicStorm(element, {
lightningFrequency: 1500, // Lightning interval (ms)
particleCount: 15, // Storm particles
stormIntensity: 0.8, // Storm intensity
color: '#C8C8FF' // Lightning color
});
galaxy.animations.initInterstellarTravel(element, {
starCount: 20, // Number of star trails
speed: 3, // Travel speed
trailLength: 30, // Star trail length
color: '#FFFFFF' // Star trail color
});
galaxy.animations.initBlackHoleMerger(element, {
approachSpeed: 0.2, // Orbital decay speed
waveCount: 3, // Gravitational waves
mergeRadius: 0, // Merge distance
cycleTime: 6000 // Time per cycle (ms)
});
galaxy.animations.initCosmicSymphony(element, {
barCount: 12, // Number of sound bars
waveSpeed: 0.1, // Wave animation speed
amplitude: 30, // Bar height amplitude
gradient: true // Use gradient colors
});
galaxy.animations.initSolarFlare(element, {
flareInterval: 1500, // Time between flares (ms)
flareLength: 60, // Flare length (px)
flareWidth: 4, // Flare width (px)
color: '#FFC832' // Flare color
});
galaxy.animations.initBinaryStars(element, {
orbitRadius: 35, // Orbit radius
orbitSpeed: 0.03, // Orbital speed
star1Color: '#FFC864', // Primary star color
star2Color: '#96C8FF' // Secondary star color
});
galaxy.animations.initDwarfPlanet(element, {
planetSize: 12, // Planet size (px)
orbitRadius: 40, // Orbit radius
orbitSpeed: 0.02, // Orbital speed
color: '#C89664' // Planet color
});
Global configuration options:
const galaxy = new GalaxyJS({
debug: true, // Enable debug mode
autoInit: true, // Auto-initialize
particleCount: 100, // Default particle count
trailLength: 20, // Mouse trail length
theme: 'dark', // Theme (dark/light)
performance: 'high' // Performance mode
});
// Create custom particle system
const particleSystem = galaxy.animations.createParticleSystem(container, {
particleCount: 200,
gravity: 0.1,
friction: 0.98,
bounce: 0.8
});
// Stop the system
particleSystem.isActive = false;
// Create mouse trail
const mouseTrail = galaxy.animations.initMouseTrail(container, {
trailLength: 30,
particleSize: 4,
fadeSpeed: 0.95
});
// Create gravity simulation
const gravitySim = galaxy.animations.initGravitySimulation(container, {
bodyCount: 8,
gravity: 0.5
});
// Listen for animation events
document.addEventListener('galaxyjs:initialized', (e) => {
console.log('GalaxyJS initialized', e.detail);
});
document.addEventListener('galaxyjs:demo-click', (e) => {
console.log('Demo clicked:', e.detail.demoType);
});
<!DOCTYPE html>
<html>
<head>
<title>GalaxyJS Example</title>
<link rel="stylesheet" href="css/animations.css">
</head>
<body>
<div class="pulsar-animation">
<div class="pulsar-core"></div>
<div class="pulsar-waves"></div>
</div>
<script src="js/main.js"></script>
<script src="js/animations.js"></script>
<script>
// Initialize GalaxyJS
const galaxy = new GalaxyJS({
debug: true,
autoInit: true
});
// Create pulsar animation
galaxy.animations.initPulsar('.pulsar-animation', {
frequency: 2,
intensity: 0.8
});
</script>
</body>
</html>