This is an extension of Manim that helps drawing nice looking gears.
Project description
manim-Gearbox
This is a plugin for Manim that enables you to draw realistic looking gears and mechanisms. So far only involute gears are supported, with inside and outside gears.
Planned further development:
- Rack and pinion
- Cycloid gears, cycloid rack
- Sliced gears
- Animation helpers
Installation
manim-gearbox
is a package on pypi, and can be directly installed using pip:
pip install manim-gearbox
Usage
Make sure include these two imports at the top of the .py file
from manim import *
from manim_gearbox import *
Examples
2 basic gears
class gear_example(Scene):
def construct(self):
# small gear
gear1=Gear(15, stroke_opacity=0, fill_color=WHITE,fill_opacity=1)
# larger gear
gear2=Gear(25, stroke_opacity=0, fill_color=RED, fill_opacity=1)
# shifting gear1 away from center
gear1.shift(-gear1.rp * 1.5 * RIGHT)
# position gear2 next to gear1 so that they mesh together
gear2.mesh_to(gear1)
self.add(gear1, gear2)
self.play(Rotate(gear1, gear1.pitch_angle, rate_func=linear),
Rotate(gear2, - gear2.pitch_angle, rate_func=linear),
run_time=4)
inner gear
class gear_example_inner(Scene):
def construct(self):
# smaller gear
gear1 = Gear(15, module=1, stroke_opacity=0, fill_color=WHITE,fill_opacity=1)
# larger gear with inner teeth
gear2 = Gear(36, module=1, inner_teeth=True, stroke_opacity=0, fill_color=RED, fill_opacity=1)
gear1.shift(gear1.rp * UP)
gear2.mesh_to(gear1)
self.add(gear1)
self.add(gear2)
self.play(Rotate(gear1, gear1.pitch_angle, rate_func=linear),
Rotate(gear2, gear2.pitch_angle, rate_func=linear),
run_time=10)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
manim-GearBox-0.2.2.tar.gz
(7.6 kB
view hashes)
Built Distribution
Close
Hashes for manim_GearBox-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4566c190fd1fb5087dabfd22ce7d5e5f6e91b8161bdb79019da376dcd977854a |
|
MD5 | 93698f37a3efe00697dadad798e2a8d6 |
|
BLAKE2b-256 | bb625b9840ce1e421f44871dd41f2784ea37c18cc9ab21448c37c5794caf1751 |