SuperAPI AI Directory

physics-animator

General & other

View repository

Updated 10-16 02:37

About this skill

Physics Animator - Physical Science Animation Generator

Generate high-quality 3D animations for popular science articles on platforms such as Zhihu.

How to Use

When the user says "draw an XX", first check whether there is an existing script under scripts/ ; if so, call it directly; if not, create a new one.

Existing Animation Scripts

Script Name Description Call Example
oscillator.py Simple pendulum sine curve · time perspective ω (paper-tape style) python scripts/oscillator.py
wave_vector_k.py Wave vector k · spatial perspective (phase distribution of a row of simple pendulums) python scripts/wave_vector_k.py
traveling_wave.py Traveling wave sin(ωt-kx) · combined space-time (wave propagation) python scripts/traveling_wave.py

How to Call

# 激活虚拟环境
source /Users/xie/.openclaw/workspace/.venv/bin/activate

# 运行脚本(输出到 output/ 目录)
cd <skill_dir>
python scripts/oscillator.py [--axis-label 位置|时间] [--frames 120] [--fps 24]

Output

  • Unified output GIF animation(can be uploaded directly to Zhihu)
  • Files are saved in the output/ directory

⚠️ Key: GIF format essentials (playback on Feishu/WeChat)

When saving a GIF, you must set disposal=2, otherwise the following will occur:

  • Ghosting, trailing
  • The animation only shows the first frame
  • Cannot play on WeChat/Feishu
# 正确写法
gif.save(out_path, save_all=True, append_images=frames,
         duration=42, loop=0, disposal=2)

Reason:disposal=2 means clearing the background before drawing each frame, ensuring each frame is independent.

Specifications for New Animation Scripts

  1. Place under the scripts/ directory
  2. Output to the output/ directory
  3. Default output format is GIF
  4. Write a parameter configuration section at the top for easy adjustment
  5. Render each frame independently (to avoid ghosting)
  6. Use the Arial Unicode MS / PingFang SC font for Chinese labels
  7. Support command-line arguments to override default configuration
  8. After completion, update the script list in this file

Dependencies

numpy
matplotlib
Pillow

Virtual environment:/Users/xie/.openclaw/workspace/.venv/

Standard 3D perspective (globally unified)

All 3D animations use the following perspective by default, maintaining consistency in Crab Uncle's output content:

  • view_init(elev=25, azim=-60)
  • Coordinate panel color: white/transparent (fade the background)
  • Grid lines: extremely light gray (0.9, 0.9, 0.9, 0.3)

Standard color scheme (globally unified)

Element Color Color Value
Protagonist ball/moving body Orange-red #FF5722
Protagonist ball border Dark orange #D84315
Phantom/historical traces Light gray #CCCCCC
Trajectory curve Blue #2196F3
Spatial axis labels Green #4CAF50
Label text color matches the color of the corresponding element — —

Design Principles

  • Popular science first, intuitiveness prioritized
  • 3D perspective, physically intuitive (gravity downward, etc.)
  • Leave phantoms at key positions to help readers understand the motion process
  • Concise labels, mainly in Chinese
  • Label color matches the color of the corresponding element (protagonist label = protagonist color, phantom label = phantom color)
  • Coordinate panel white/transparent, fading the background's interference with the main elements