Implement #3: COOL EXPLOSIONS WHILE U tyPE - #4
Open
cjbest wants to merge 2 commits into
Open
Conversation
Co-Authored-By: Claude <claude@anthropic.com>
Owner
Author
|
@claude these explosions look like crap. Instead make it look like the cursor is on fire (cool realistic flame, with realistic smoke, leaves a temporarly ember/burn as it goes for a few hundred ms and fades out) |
@claude these explosions look like crap. Instead make it look like the cursor is on fire (cool realistic flame, with realistic smoke, leaves a temporarly ember/burn as it goes for a few hundred ms and fades out) Co-Authored-By: Claude <claude@anthropic.com>
|
Done! I've pushed changes and updated the demo GIF. Please review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3
Summary
PR Summary: Cool Explosions While You Type
Description
Implemented an awesome explosion animation system that creates colorful particle bursts at the cursor position while typing in the Drift editor. The feature is toggleable via keyboard shortcut and menu item.
Key Features
Key Files Changed
src/components/Editor.tsx
ExplosionParticlewidget class that creates individual particle DOM elementsexplosionAnimatorViewPlugin that detects typing events and creates explosion decorationsexplosionsEnabledglobal state variable (reads from localStorage)onToggleExplosionsprop to EditorProps interfacesrc/components/Editor.css
.explosion-particleclass for styling particle elements@keyframes explosion-burstanimation that:src/App.tsx
toggleExplosions()function that:onToggleExplosionsprop to Editor componentsrc-tauri/src/lib.rs
e2e/explosions.spec.ts (NEW)
Design Decisions
ViewPlugin Architecture: Used CodeMirror's ViewPlugin system to integrate seamlessly with the editor's update cycle. This ensures explosions trigger on actual user input (not programmatic changes).
Widget Decorations: Particles are implemented as widget decorations positioned at the cursor. This approach:
User Event Detection: The plugin specifically checks for
tr.isUserEvent('input')to only trigger on typing, not on other document changes (like AI edits or file loads).Particle Cleanup: Explosions older than 1 second are automatically cleaned from the map to prevent memory leaks.
Polar Coordinates: Used polar coordinates (angle + distance) in CSS for natural radial burst pattern:
Page Reload for Toggle: The toggle requires a page reload because the
explosionsEnabledvariable is read at module load time. This keeps the implementation simple and ensures consistent state.Default Enabled: Explosions are enabled by default (localStorage check for
!== 'false'), making the feature immediately discoverable.Testing
All tests pass:
The feature is production-ready and provides a fun, engaging visual effect while maintaining code quality and test coverage.
Demo
🤖 Generated with Claude Code