-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade manim-with-ease to v0.18.0, added release tour
- Loading branch information
Showing
2 changed files
with
356 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM manimcommunity/manim:v0.17.3 | ||
FROM manimcommunity/manim:v0.18.0 | ||
|
||
USER root | ||
RUN pip install notebook | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,355 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5ce1f953-7934-48e1-9890-eb5b04aa1896", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from manim import *" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "857b3499-a07f-4380-b772-7b6734a0c4f4", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"config.media_width = \"100%\"\n", | ||
"config.verbosity = \"WARNING\"\n", | ||
"config.pixel_width = 600\n", | ||
"config.pixel_height = 400\n", | ||
"\n", | ||
"config.background_color = LOGO_BLACK" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8c5cc9f7-d73c-4be1-a8cf-3f9c3ca3b2f0", | ||
"metadata": {}, | ||
"source": [ | ||
"## All new: Manim's coloring system" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "441fdcb4-6cd2-486a-8035-b8e3f3b86dee", | ||
"metadata": {}, | ||
"source": [ | ||
"Check what Manim's documentation has to say about colors: https://docs.manim.community/en/v0.18.0/reference/manim.utils.color.html" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e2660fc7-d357-4142-9536-ab02f9731ae5", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# all new color implementation!\n", | ||
"ManimColor?" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a88a5b9d", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"color_inputs = VGroup(\n", | ||
" ManimBanner().set(color=ManimColor(\"#c0ffee\")), # from hexcode\n", | ||
" ManimBanner().set(color=ManimColor((132, 122, 85))), # from RGB int tuple (range 0-255)\n", | ||
" ManimBanner().set(color=ManimColor((0.32, 0.35, 0.7))), # from rgb float tuple (range 0-1)\n", | ||
" ManimBanner().set(color=ManimColor(8435209)), # from internal integer: 8435209 == 0x80B609 -> \"#80B609\"\n", | ||
").arrange_in_grid(2, 2, buff=1).scale_to_fit_width(config.frame_width-1)\n", | ||
"color_inputs.get_image()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5a4625f6", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"squares = VGroup( # careful not to mix int/float up!\n", | ||
" Square(color=ManimColor((1, 1, 1)), fill_opacity=1),\n", | ||
" Square(color=ManimColor((1., 1., 1.)), fill_opacity=1),\n", | ||
").scale(2).arrange(RIGHT)\n", | ||
"squares.get_image()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "4e96bc42", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"squares = VGroup( # arguments to ManimColor can be passed to color-arguments directly:\n", | ||
" Square(color='maroon', fill_opacity=1),\n", | ||
" Square(color='Maroon', fill_opacity=1),\n", | ||
" Square(color='mArOon', fill_opacity=1),\n", | ||
").scale(2).arrange(RIGHT)\n", | ||
"squares.get_image()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "9ee305d7-12ed-4203-a283-500866edf077", | ||
"metadata": {}, | ||
"source": [ | ||
"New: Manim comes with more predefined colors, see their module documentations:\n", | ||
"- `manim_colors` [Colors included in the global name space.](https://docs.manim.community/en/v0.18.0/reference/manim.utils.color.manim_colors.html#module-manim.utils.color.manim_colors)\n", | ||
"- `AS2700` [Australian Color Standard](https://docs.manim.community/en/v0.18.0/reference/manim.utils.color.AS2700.html#module-manim.utils.color.AS2700)\n", | ||
"- `BS381` [British Color Standard](https://docs.manim.community/en/v0.18.0/reference/manim.utils.color.BS381.html#module-manim.utils.color.BS381)\n", | ||
"- `XKCD` [Colors from the XKCD Color Name Survey](https://docs.manim.community/en/v0.18.0/reference/manim.utils.color.XKCD.html#module-manim.utils.color.XKCD)\n", | ||
"- `X11` [X11 Colors](https://docs.manim.community/en/v0.18.0/reference/manim.utils.color.X11.html#module-manim.utils.color.X11)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ba53b8c8-ef21-4ac8-9f6f-e03823513a75", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%%manim -qh NewColors\n", | ||
"\n", | ||
"class NewColors(Scene):\n", | ||
" def construct(self):\n", | ||
" self.camera.background_color = '#000000'\n", | ||
" \n", | ||
" xkcd_color_mobjects = VMobject()\n", | ||
" xkcd_colors = [\n", | ||
" color for color_name, color in \n", | ||
" inspect.getmembers(XKCD, lambda obj: isinstance(obj, ManimColor))\n", | ||
" ]\n", | ||
" \n", | ||
" for color in xkcd_colors:\n", | ||
" col_square = Square()\n", | ||
" col_square.set_fill(color, opacity=1)\n", | ||
" col_square.set_stroke(opacity=0)\n", | ||
" xkcd_color_mobjects.add(col_square)\n", | ||
" \n", | ||
" def color_sort(col):\n", | ||
" h, s, v = col.to_hsv()\n", | ||
" return h, v\n", | ||
" \n", | ||
" xkcd_sorted_ind = sorted(\n", | ||
" range(len(xkcd_colors)),\n", | ||
" key=lambda ind: xkcd_colors[ind].to_hsv()\n", | ||
" )\n", | ||
" \n", | ||
" xkcd_color_mobjects.arrange_in_grid(23, 41)\n", | ||
" xkcd_color_mobjects.width = config.frame_width\n", | ||
" \n", | ||
" for ind, col_square in enumerate(xkcd_color_mobjects):\n", | ||
" col_square.generate_target()\n", | ||
" target_ind = xkcd_sorted_ind.index(ind)\n", | ||
" col_square.target.move_to(xkcd_color_mobjects[target_ind])\n", | ||
" \n", | ||
" \n", | ||
" self.play(FadeIn(xkcd_color_mobjects, lag_ratio=0.001, run_time=5))\n", | ||
" self.wait()\n", | ||
" \n", | ||
" move_squares = AnimationGroup(*[\n", | ||
" MoveToTarget(col_square)\n", | ||
" for col_square in xkcd_color_mobjects\n", | ||
" ],\n", | ||
" lag_ratio=0.001,\n", | ||
" run_time=5,\n", | ||
" )\n", | ||
" self.play(move_squares)\n", | ||
" self.wait(1)\n", | ||
" \n", | ||
" self.play(FadeOut(xkcd_color_mobjects, lag_ratio=0.001, run_time=5))\n", | ||
" \n", | ||
" " | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "48148199-9c2c-4bf0-95e3-95003db6f14b", | ||
"metadata": {}, | ||
"source": [ | ||
"## New: Added new module `manim.typing`, plus lots of type hints" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "50d9b91c-3581-48c3-9e21-ced02acf04f7", | ||
"metadata": {}, | ||
"source": [ | ||
"Type hints are what allow your IDE to provide useful autocompletion.\n", | ||
"\n", | ||
"New: Several predefined types, and a (start of) complete overhaul of our internal typing guidelines, see https://docs.manim.community/en/v0.18.0/contributing/typings.html" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f03345ba-c93b-4824-823f-d55341caa72a", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"VMobject?" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ef98fc42-3415-497d-8ef4-da7e892b7031", | ||
"metadata": {}, | ||
"source": [ | ||
"## New: `manim checkhealth`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f66f76ea-ea33-4fcf-9c1c-347d2946dfd4", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!manim checkhealth --help" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "e07f671b-ce7b-40d1-b9ca-f7721fd76163", | ||
"metadata": {}, | ||
"source": [ | ||
"## New rate functions: `smoothstep`, `smootherstep`, `smoothererstep`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c9477e52-258d-450a-b064-6f092cabc29e", | ||
"metadata": {}, | ||
"source": [ | ||
"Documentation incl. list of rate functions: https://docs.manim.community/en/stable/reference/manim.utils.rate_functions.html" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a84f7c0a-e856-4f88-97d3-8afa063f9a76", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%%manim -qh RateFuncDemo\n", | ||
"\n", | ||
"config.background_color = '#455D3E'\n", | ||
"\n", | ||
"class RateFuncDemo(Scene):\n", | ||
" def construct(self):\n", | ||
" props = [\n", | ||
" (\"smooth\", X11.SIENNA1),\n", | ||
" (\"smoothstep\", X11.SIENNA2),\n", | ||
" (\"smootherstep\", X11.SIENNA3),\n", | ||
" (\"smoothererstep\", X11.SIENNA4)\n", | ||
" ]\n", | ||
" squares = VGroup()\n", | ||
" for label_text, color in props:\n", | ||
" col_square = Square()\n", | ||
" col_square.set_fill(color, opacity=1)\n", | ||
" col_square.set_stroke(opacity=0)\n", | ||
" label = Text(label_text, font_size=24, font=\"Monospace\")\n", | ||
" label.next_to(col_square, UP)\n", | ||
" col_square.add(label)\n", | ||
" squares.add(col_square)\n", | ||
" \n", | ||
" squares.arrange(RIGHT, buff=1).shift(2*UP)\n", | ||
" self.add(squares)\n", | ||
" \n", | ||
" progress = VDict({\n", | ||
" \"line\": Line(4*LEFT, 4*RIGHT),\n", | ||
" \"marker\": Dot(radius=0.15)\n", | ||
" })\n", | ||
" progress[\"marker\"].move_to(progress[\"line\"].point_from_proportion(0))\n", | ||
" progress.next_to(squares, UP)\n", | ||
" self.add(progress)\n", | ||
" \n", | ||
" anims = []\n", | ||
" for ind, (rate_name, _) in enumerate(props):\n", | ||
" rate_func = getattr(rate_functions, rate_name)\n", | ||
" anims.append(squares[ind].animate(run_time=4, rate_func=rate_func).shift(4*DOWN))\n", | ||
" \n", | ||
" self.wait()\n", | ||
" self.play(\n", | ||
" *anims, \n", | ||
" UpdateFromAlphaFunc(\n", | ||
" progress, \n", | ||
" lambda mobj, alpha: mobj[\"marker\"].move_to(mobj[\"line\"].point_from_proportion(alpha)),\n", | ||
" run_time=4,\n", | ||
" rate_func=linear,\n", | ||
" )\n", | ||
" )\n", | ||
" self.wait()\n", | ||
" " | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "81fe830e-547f-497e-b39e-636fd267dcf4", | ||
"metadata": {}, | ||
"source": [ | ||
"### ... and several other improvements!\n", | ||
"\n", | ||
"Full list of changes: https://docs.manim.community/en/v0.18.0/changelog/0.18.0-changelog.html" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5669e231-0056-488e-820a-4a521135a15a", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.0" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |