Captain Arro ⬅⛵️➡
Captain Arro is a Python library for generating animated SVG arrows for web interfaces. Create beautiful, customizable arrow animations with just a few lines of code.
Yes, this package is totally vibe coded. It's useful anyhow!
Features
- 🎯 Four arrow types: Moving flow, spotlight flow, bouncing spread, and spotlight spread
- 🎨 Fully customizable: Colors, sizes, speeds, directions, and animations
- 🔧 Type-safe: Full TypeScript-style type hints for better development experience
- 📦 Zero dependencies: Pure Python implementation
- 🌐 Web-ready: Generates clean SVG code for direct HTML embedding
Installation
pip install captain-arro
Quick Start
from captain_arro import MovingFlowArrowGenerator
# Create a simple right-pointing arrow
generator = MovingFlowArrowGenerator()
svg_content = generator.generate_svg()
# Save to file
generator.save_to_file("my_arrow.svg")
Arrow Types
1. Moving Flow Arrows
Arrows that move continuously in one direction with a flowing animation.
from captain_arro import MovingFlowArrowGenerator
# Blue arrows moving right
generator = MovingFlowArrowGenerator(
direction="right",
stroke_width=8,
color="#3b82f6",
num_arrows=6,
width=150,
height=100,
speed_in_px_per_second=25,
animation="ease-in-out"
)
2. Spotlight Flow Arrows
Arrows with a moving spotlight effect that highlights different parts.
from captain_arro import SpotlightFlowArrowGenerator
# Purple spotlight effect
generator = SpotlightFlowArrowGenerator(
direction="right",
color="#8b5cf6",
num_arrows=3,
width=180,
height=120,
speed_in_px_per_second=40.0,
spotlight_size=0.3,
dim_opacity=0.5
)
3. Bouncing Spread Arrows
Arrows that spread outward from center with a bouncing animation.
from captain_arro import BouncingSpreadArrowGenerator
# Teal arrows spreading horizontally
generator = BouncingSpreadArrowGenerator(
direction="horizontal",
color="#14b8a6",
num_arrows=4,
width=250,
height=100,
speed_in_px_per_second=15.0,
animation="ease-in-out",
center_gap_ratio=0.3,
stroke_width=10
)
4. Spotlight Spread Arrows
Spread arrows with spotlight effects radiating from center.
from captain_arro import SpotlightSpreadArrowGenerator
# Indigo spotlight spreading horizontally
generator = SpotlightSpreadArrowGenerator(
direction="horizontal",
color="#6366f1",
stroke_width=12,
num_arrows=8,
width=300,
height=100,
speed_in_px_per_second=100.0,
spotlight_size=0.25,
dim_opacity=0.5,
center_gap_ratio=0.3,
)
Configuration Options
Common Parameters
All generators support these base parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
color |
str |
"#2563eb" |
Arrow color (hex, rgb, named colors) |
stroke_width |
int |
10 |
Line thickness (min: 2) |
width |
int |
100 |
SVG width in pixels |
height |
int |
100 |
SVG height in pixels |
speed |
float |
20.0 |
Animation speed (pixels per second) |
num_arrows |
int |
4 |
Number of arrows to display |
Flow Arrow Parameters
| Parameter | Type | Options | Description |
|---|---|---|---|
direction |
FLOW_DIRECTIONS |
"right", "left", "up", "down" |
Arrow movement direction |
animation |
ANIMATION_TYPES |
"ease-in-out", "linear", "ease", etc. |
Animation timing function |
Spotlight Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
spotlight_size |
float |
0.3 |
Size of spotlight effect (0.1-1.0) |
spotlight_path_extension_factor |
float |
1.0 |
Factor by which the path of the spotlight is extended |
dim_opacity |
float |
0.2 |
Opacity of dimmed areas (0.0-1.0) |
Spread Arrow Parameters
| Parameter | Type | Options | Description |
|---|---|---|---|
direction |
SPREAD_DIRECTIONS |
"horizontal", "vertical" |
Spread orientation |
center_gap_ratio |
float |
0.2 |
Gap size in center (0.1-0.4) |
Advanced Usage
Custom Animations
from captain_arro import MovingFlowArrowGenerator
# Fast linear animation upward
generator = MovingFlowArrowGenerator(
direction="up",
speed_in_px_per_second=50.0,
animation="linear",
num_arrows=6
)
Responsive Sizing
# Large arrow for desktop
desktop_arrow = MovingFlowArrowGenerator(width=300, height=120)
# Small arrow for mobile
mobile_arrow = MovingFlowArrowGenerator(width=150, height=60)
Color Theming
# Dark theme
dark_arrow = SpotlightFlowArrowGenerator(
color="#ffffff",
dim_opacity=0.1
)
# Brand colors
brand_arrow = BouncingSpreadArrowGenerator(
color="#your-brand-color"
)
HTML Integration
Embed generated SVGs directly in your HTML:
<!-- Option 1: Inline SVG -->
<div class="arrow-container">
<!-- Paste SVG content here -->
</div>
<!-- Option 2: External file -->
<img src="path/to/arrow.svg" alt="Animated arrow" />
<!-- Option 3: CSS background -->
<div style="background-image: url('path/to/arrow.svg')"></div>
Type Safety
Captain Arro includes full type annotations for excellent IDE support:
from captain_arro import FLOW_DIRECTIONS, ANIMATION_TYPES
# TypeScript-style literal types
direction: FLOW_DIRECTIONS = "right" # ✅ Valid
direction: FLOW_DIRECTIONS = "invalid" # ❌ Type error
animation: ANIMATION_TYPES = "ease-in-out" # ✅ Valid
animation: ANIMATION_TYPES = "bounce" # ❌ Type error
Examples
The examples/ directory contains comprehensive usage examples:
# Generate all example SVGs
python examples/basic_usage.py
# View examples
ls examples/output/
See examples/README.md for detailed descriptions of each example.
Development
Running Tests
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=captain_arro
Code Quality
# Format code
black captain_arro tests examples
# Sort imports
isort captain_arro tests examples
# Type checking
mypy captain_arro
# Linting
flake8 captain_arro tests examples
API Reference
Base Classes
AnimatedArrowGeneratorBase- Abstract base class for all generators
Generator Classes
MovingFlowArrowGenerator- Moving flow arrowsSpotlightFlowArrowGenerator- Spotlight flow arrowsBouncingSpreadArrowGenerator- Bouncing spread arrowsSpotlightSpreadArrowGenerator- Spotlight spread arrows
Type Definitions
ANIMATION_TYPES- Valid animation timing functionsFLOW_DIRECTIONS- Valid flow directionsSPREAD_DIRECTIONS- Valid spread directions
Browser Compatibility
Generated SVGs work in all modern browsers that support:
- SVG animations (
animateTransform) - CSS animations (
@keyframes) - Linear gradients
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
v0.1.0
- Initial release
- Four arrow generator types
- Full type safety
- Comprehensive test suite
- Documentation and examples
Made with ❤️ and good vibes
Metadata
Release files for captain-arro 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| captain_arro-0.1.3.tar.gz | 28.5 kB | Without provenance | Details for captain_arro-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| captain_arro-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for captain_arro-0.1.3-py3-none-any.whl |
Total release size: 51.0 kB
Release files / captain_arro-0.1.3.tar.gz
| Download URL | captain_arro-0.1.3.tar.gz |
|---|---|
| Size | 28.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d56da895190605e290d929f36a1402192d3c40994361f3bad3a6c1ba479d387
|
|
BLAKE2b-256 checksum How to use checksums |
7240057868bd5fe7b9fe918814bb4c4eeb95e9c6977440f98823c11b55b3a537
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Release files / captain_arro-0.1.3-py3-none-any.whl
| Download URL | captain_arro-0.1.3-py3-none-any.whl |
|---|---|
| Size | 22.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d21da26ea39f76302673b77dfb1c269cc1f95f6292d756fa635efafcf392ace
|
|
BLAKE2b-256 checksum How to use checksums |
90e295bd4563646deac6827a1a3873b5008c5cd7073dadb568e2470b50b3f7c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Security for captain-arro 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.