feat: Add animated arrows and highlight boxes for Typst preview #1
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.
This PR implements a comprehensive annotation system that allows users to draw and position absolutely positioned arrows and highlight boxes on Typst document previews, with support for keyframe-based animations.
Overview
The feature provides an interactive overlay system for adding visual annotations to Typst documents without modifying the original source files. Users can create animated arrows and highlight boxes that help emphasize content during presentations or documentation reviews.
Key Features
Drawing Tools
Animation System
User Interface
Ctrl+Shift+Ato toggle mode, tool selection shortcutsTechnical Implementation
Frontend (
tools/typst-preview-frontend/)Backend (
crates/typst-preview/)VS Code Extension (
editors/vscode/)tinymist.toggleAnnotationModeand tool selection.vscode/tinymist-annotations/for version control compatibilityData Format
Annotations use a transparent JSON format that's completely separate from Typst documents:
{ "version": "1.0.0", "documentId": "/path/to/document.typ", "annotations": [ { "id": "arrow1", "type": "arrow", "start": {"x": 100, "y": 100}, "end": {"x": 200, "y": 200}, "color": "#ff0000", "thickness": 2 } ], "animations": [ { "annotationId": "arrow1", "keyframes": [ {"time": 0, "properties": {"opacity": 0}}, {"time": 1000, "properties": {"opacity": 1}} ], "duration": 1000, "easing": "ease-in-out" } ] }Usage Examples
Basic Annotation
Ctrl+Shift+Ato enable annotation modeAnimation Creation
Benefits
This implementation provides a production-ready annotation system that enhances the Typst preview experience with interactive visual elements, making it ideal for educational content, documentation, and collaborative reviews.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.