Short introduction to Manim: Difference between revisions
(14 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
Manim or manimgl. | |||
Virtual engine | |||
<syntaxhighlight lang="bash"> | |||
python -m venv . | |||
source bin/activate | |||
</syntaxhighlight> | |||
Some short manim scrips to generate easy visualizations. | Some short manim scrips to generate easy visualizations. | ||
Line 38: | Line 48: | ||
self.add( plane ) | self.add( plane ) | ||
</pre> | </pre> | ||
=== Install Manim on Arch Linux === | |||
Pip is not working on a virtual environment. However use <code>uv</code> to install it. That works (on Sep 2024): | |||
<code> | |||
uv pip install manim | |||
</code> | |||
It is now installed on virtual environment, but the global system is not affected (not working outside virtual environment). | |||
== BG plane == | |||
<syntaxhighlight lang="python"> | |||
number_plane = NumberPlane( | |||
background_line_style={ | |||
"stroke_color": TEAL, | |||
"stroke_width": 1, | |||
"stroke_opacity": 0.2 | |||
} | |||
) | |||
self.add(number_plane) | |||
</syntaxhighlight > | |||
== Bezier curve == | == Bezier curve == | ||
Line 46: | Line 79: | ||
https://github.com/markkuleino/manim/blob/main/FLL_CC0_bezier.py | https://github.com/markkuleino/manim/blob/main/FLL_CC0_bezier.py | ||
See tutorial on Bezier Curves https://pomax.github.io/bezierinfo/ and the interactive tutorial https://www.jasondavies.com/animated-bezier/ | |||
== Heat engine == | |||
<gallery> | |||
CarnotCycle.gif|Carnot cycle. Remove bg. | |||
Ottocycle.gif|Otto cycle. Remove bg. | |||
DieselCycle.gif|Diesel cycle. Remove bg. | |||
</gallery> | |||
*[[File:Carnot.zip]] | |||
*[[File:otto.zip]] | |||
*[[File:diesel.zip]] | |||
== Paths == | |||
https://github.com/Elteoremadebeethoven/AnimationsWithManim/blob/master/English/extra/faqs/paths.md | |||
* Show Points | |||
* Path as corners | |||
* Path smoothly | |||
* Bezier points of a path | |||
* Change path style | |||
== Lines == | == Lines == | ||
https://github.com/markkuleino/manim/blob/main/FLL_CC2_m13b.py | https://github.com/markkuleino/manim/blob/main/FLL_CC2_m13b.py |
Latest revision as of 08:41, 10 September 2024
Introduction
Manim or manimgl.
Virtual engine
python -m venv .
source bin/activate
Some short manim scrips to generate easy visualizations.
manim -pql bez2.py manim -pqh bez2.py BezierSplineExample --format=png f: open the directory/ folder i: generate gif file p: play qm, qh, qk: quality (low, high, 4k) qh: high quality s: save last frame t: transparent background
config.background_color = WHITE
Add a background image
bg_image = ImageMobject("bg_P5.png") self.add( bg_image )
Add the background plane
plane = NumberPlane( background_line_style={ "stroke_color": BLACK, "stroke_width": 4, "stroke_opacity": 1 }, x_range=[-10, 10, 1], y_range=[-10, 10, 1], ) self.add( plane )
Install Manim on Arch Linux
Pip is not working on a virtual environment. However use uv
to install it. That works (on Sep 2024):
uv pip install manim
It is now installed on virtual environment, but the global system is not affected (not working outside virtual environment).
BG plane
number_plane = NumberPlane(
background_line_style={
"stroke_color": TEAL,
"stroke_width": 1,
"stroke_opacity": 0.2
}
)
self.add(number_plane)
Bezier curve
Animated bezier curve with two points:
https://github.com/markkuleino/manim/blob/main/FLL_CC0_bezier.py
See tutorial on Bezier Curves https://pomax.github.io/bezierinfo/ and the interactive tutorial https://www.jasondavies.com/animated-bezier/
Heat engine
-
Carnot cycle. Remove bg.
-
Otto cycle. Remove bg.
-
Diesel cycle. Remove bg.
Paths
https://github.com/Elteoremadebeethoven/AnimationsWithManim/blob/master/English/extra/faqs/paths.md
- Show Points
- Path as corners
- Path smoothly
- Bezier points of a path
- Change path style
Lines
https://github.com/markkuleino/manim/blob/main/FLL_CC2_m13b.py