All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Trails now fully fade to the background instead of leaving dim residue. Replaced
source-overRGB blending (which got stuck 1-2 units above bg due to 8-bit integer rounding) withdestination-outalpha decay followed bydestination-overgradient refill. - Stars now reset at the camera plane (
z = 0) instead ofz = -200, so projection scale no longer spikes to 3x right before the star vanishes. - Added a proximity brightness fade so stars dim smoothly into the reset point instead of disappearing at full brightness.
updateConfignow applies combinedstarCount+starColors/starSizeupdates correctly (previously the color/size branch was skipped whenstarCountwas also passed).updateConfigno longer stops and restarts the animation internally, eliminating a delta-time blip every time the optimizer retuned the star count.backgroundconfig is now validated at construction and viaupdateConfig; malformed gradients throw a clear error instead of crashing deep inside the render pipeline.
- Version log is now printed once per page rather than once per instance.
- FPS computation is performed once per frame and shared between the optimizer and
getCurrentFPS(). - Rolling frame-timestamp window now covers the full 3-second continuous measurement duration with headroom.
- Normalization constant changed from
deltaTime / 16.67todeltaTime * 60 / 1000(removes a 0.02% speed bias).
_renderno longer allocates an offscreen canvas and copies the main canvas to it on every frame._updatemutates stars in place via a new_resetStarhelper, avoiding a per-reset throwaway object allocation.
2.0.3 - 2025-10-24
- Added comprehensive CHANGELOG.md with full version history
- Updated README.md with v2.0.0+ gradient API format and examples
- Added migration guide for upgrading from v1.x to v2.x
- Added performance optimization documentation
- Updated TypeScript definitions with
@sincetags for breaking changes - Corrected default gradient colors in all documentation
2.0.2 - 2025-10-24
- Fixed localStorage namespace collision by changing key from
starfield-optimized-countto@byteventures/starfield:optimized-count
2.0.1 - 2025-10-24
- Fixed frame-rate dependent speed with delta time compensation for consistent animation speed across different refresh rates (60Hz, 120Hz, etc.)
2.0.0 - 2025-10-24
Background Gradient Configuration
The background gradient configuration structure has changed from CSS-based to canvas-native API for proper interaction with the trail effect.
Old (v1.x):
background: {
gradient: 'radial-gradient(ellipse at center, #001018 0%, #000 100%)'
}New (v2.0.0+):
background: {
type: 'radial',
colors: [
{ stop: 0, color: '#001018' },
{ stop: 1, color: '#000000' }
]
}Migration Instructions:
- If you're using the default gradient, no changes needed - just update the library
- If you have custom gradient configuration:
- Change
gradient: 'radial-gradient(...)'to the new object structure - Convert your CSS gradient string to
{ type, colors }format - Extract color stops from your CSS gradient string
- Change
Example Migration:
// Before (v1.x)
const starfield = new Starfield('#canvas', {
background: {
gradient: 'radial-gradient(circle, #ff0000 0%, #0000ff 100%)'
}
});
// After (v2.0.0+)
const starfield = new Starfield('#canvas', {
background: {
type: 'radial',
colors: [
{ stop: 0, color: '#ff0000' },
{ stop: 1, color: '#0000ff' }
]
}
});- Default gradient changed from blue-tinted (#001018 to #000000) to purple-tinted (#000000 to #341b6f)
- Background gradient now drawn directly on canvas instead of using CSS
- Automatic FPS-based performance optimization system with two-phase approach:
- Initial aggressive calibration (1s measurements, up to 8 attempts)
- Conservative continuous optimization (3s measurements every 10s)
- localStorage caching of optimized star count for instant adaptation on repeat visits
debugconfiguration option to enable console logging for performance optimization (default:false)maxStarCountconfiguration option to cap maximum stars during auto-optimization (default:10000)getCurrentFPS()method to check real-time performance
- Gradient now properly interacts with trail effect (previously gradient was CSS-based and didn't blend with canvas trails)
1.0.3 - 2024-10-XX
- Minor bug fixes and stability improvements
1.0.2 - 2024-10-XX
- Performance optimizations
1.0.1 - 2024-10-XX
- Initial release bug fixes
1.0.0 - 2024-10-XX
- Initial release
- 3D starfield animation with HTML5 Canvas
- Configurable star count, speed, colors, and size
- Background gradient support
- Trail effect (motion blur)
- Auto-start capability
- Device detection (mobile/desktop)
- Framework integration examples (Astro, React, Vue, Svelte)
- TypeScript support with full type definitions
- ES Module distribution