Testing & Performance
Performance is critical for creating smooth, responsive generative artwork. This guide covers target performance metrics, testing strategies, and optimization techniques.
Performance Targets
Downscaling Options
If your artwork cannot achieve 60 FPS at full resolution, consider these downscaling options:
Downscaling allows you to optimize for performance while maintaining visual quality. The final artwork will be upscaled back to the target resolution.
FPS Overlay
Enable the FPS overlay during development to monitor real-time performance:
window.LAYER = {
features: {
showFPS: true
}
};The overlay displays current FPS, average FPS, and memory usage to help you identify performance bottlenecks.
Board Server
Use the mainboard server for testing and previewing your artwork in a production-like environment: https://mainboard-live.layer.art/
Local Development with Cloudflare Tunnel
To test locally-hosted artwork on remote devices or in production-like environments, use Cloudflare Tunnel:
# Install Cloudflare Tunnel
npm install -g @cloudflare/wrangler
# Start tunnel to your local server
cloudflare tunnel --url http://localhost:3000This generates a public URL that exposes your local server, allowing you to access and test your artwork from any device.
Optimization Tips
Deployment Checklist
Before deploying your artwork, ensure: