generated from github/codespaces-jupyter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
375 additions
and
7 deletions.
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
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,314 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "9c2d80f9", | ||
"metadata": {}, | ||
"source": [ | ||
"Firefox is not well supported in GitHub Codespaces, so using Chrome.\n", | ||
"Cannot play mp4 in Notebook via GitHub, maybe Colab is a solution." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "f0cb14bf-3621-41cd-bc8b-f8837f82d12c", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7fbfbf; text-decoration-color: #7fbfbf\">[04/29/24 08:10:10] </span><span style=\"color: #800000; text-decoration-color: #800000\">WARNING </span> Missing Plugins: <span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">''</span><span style=\"font-weight: bold\">}</span> <a href=\"file:///usr/local/lib/python3.11/site-packages/manim/plugins/__init__.py\" target=\"_blank\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">__init__.py</span></a><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">:</span><a href=\"file:///usr/local/lib/python3.11/site-packages/manim/plugins/__init__.py#17\" target=\"_blank\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">17</span></a>\n", | ||
"</pre>\n" | ||
], | ||
"text/plain": [ | ||
"\u001b[2;36m[04/29/24 08:10:10]\u001b[0m\u001b[2;36m \u001b[0m\u001b[31mWARNING \u001b[0m Missing Plugins: \u001b[1m{\u001b[0m\u001b[32m''\u001b[0m\u001b[1m}\u001b[0m \u001b]8;id=273296;file:///usr/local/lib/python3.11/site-packages/manim/plugins/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=216321;file:///usr/local/lib/python3.11/site-packages/manim/plugins/__init__.py#17\u001b\\\u001b[2m17\u001b[0m\u001b]8;;\u001b\\\n" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"from manim import *\n", | ||
"import random " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "7540c9e8-aae4-401e-9ab5-68b980962d99", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Manim Community <span style=\"color: #008000; text-decoration-color: #008000\">v0.18.0</span>\n", | ||
"\n", | ||
"</pre>\n" | ||
], | ||
"text/plain": [ | ||
"Manim Community \u001b[32mv0.\u001b[0m\u001b[32m18.0\u001b[0m\n", | ||
"\n" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
}, | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
" \r" | ||
] | ||
}, | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<video src=\"media/jupyter/ImpredicativityAnimation@2024-04-29@08-10-22.mp4\" controls autoplay loop style=\"max-width: 60%;\" >\n", | ||
" Your browser does not support the <code>video</code> element.\n", | ||
" </video>" | ||
], | ||
"text/plain": [ | ||
"<IPython.core.display.Video object>" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"%%manim -ql --fps 30 -v WARNING ImpredicativityAnimation\n", | ||
"\n", | ||
"class ImpredicativityAnimation(Scene):\n", | ||
" def construct(self):\n", | ||
" self.camera.background_color = GREY\n", | ||
"\n", | ||
" # Create the spheres\n", | ||
" transformer = Circle(radius=1, color=BLUE, fill_color=BLUE, fill_opacity=1).shift(LEFT*2)\n", | ||
" transformer.set_z_index(1)\n", | ||
" subsystem = Square(side_length=2, color=BLACK, fill_color=BLACK, fill_opacity=1).shift(RIGHT*2)\n", | ||
" subsystem.set_z_index(3) # Ensure the square is always in front\n", | ||
" #transformer_label = Text(\"Transformer\", font_size=24).next_to(transformer, DOWN)\n", | ||
" #subsystem_label = Text(\"Subsystem\", font_size=24).next_to(subsystem, DOWN)\n", | ||
" #self.add(transformer, subsystem, transformer_label, subsystem_label)\n", | ||
" self.add(transformer, subsystem)\n", | ||
"\n", | ||
" for _ in range(4): # Loop the animation sequence twice\n", | ||
" # Initial system_input propertiesradius\n", | ||
" system_input = Circle(color=WHITE, fill_color=WHITE, fill_opacity=1).move_to(LEFT * 8)\n", | ||
" system_input.scale(0.3)\n", | ||
"\n", | ||
" # Animation: system_input moves to transformer and changes color\n", | ||
" self.play(system_input.animate.move_to(transformer.get_center()), run_time=2)\n", | ||
" self.play(system_input.animate.set_color(transformer.color))\n", | ||
"\n", | ||
" transformed_input_shape_class = type(transformer)\n", | ||
" transformed_input = transformed_input_shape_class(color=transformer.color, fill_color=transformer.color, fill_opacity=1).move_to(transformer.get_center())\n", | ||
" transformed_input.scale(0.3)\n", | ||
" transformed_input.scale_to_fit_height(system_input.height)\n", | ||
"\n", | ||
" system_output = transformed_input.copy().move_to(subsystem.get_center())\n", | ||
" \n", | ||
" # Animation: transformed_input moves to subsystem\n", | ||
" self.play(\n", | ||
" ReplacementTransform(system_input, transformed_input),\n", | ||
" transformed_input.animate.move_to(subsystem.get_center()), \n", | ||
" run_time=2\n", | ||
" )\n", | ||
"\n", | ||
" new_color = transformer.color\n", | ||
" new_shape_class = random_shape(type(transformer))\n", | ||
" efficient_cause = new_shape_class(color=BLACK, fill_color=BLACK, fill_opacity=1).move_to(subsystem.get_center())\n", | ||
" efficient_cause.scale(0.3)\n", | ||
" efficient_cause.set_z_index(2)\n", | ||
" efficient_cause.scale_to_fit_height(system_input.height)\n", | ||
"\n", | ||
" # Define a curved feedback path to the transformer\n", | ||
" path = ArcBetweenPoints(start=subsystem.get_center(), \n", | ||
" end=transformer.get_center(), \n", | ||
" angle=TAU/2)\n", | ||
"\n", | ||
" # Combined animation sequence\n", | ||
" self.play(\n", | ||
" system_output.animate.move_to(RIGHT * 8),\n", | ||
" MoveAlongPath(efficient_cause, path),\n", | ||
" run_time=3,\n", | ||
" )\n", | ||
"\n", | ||
" # Change the shape of the transformer\n", | ||
" new_transformer = new_shape_class(color=new_color, fill_color=new_color, fill_opacity=1).move_to(transformer.get_center())\n", | ||
" new_transformer.set_z_index(1)\n", | ||
" new_transformer.scale_to_fit_height(transformer.height)\n", | ||
"\n", | ||
" # efficient_cause arrives and changes the color of the transformer and fades out simultaneously\n", | ||
" self.play(\n", | ||
" ReplacementTransform(transformer, new_transformer),\n", | ||
" FadeOut(efficient_cause)\n", | ||
" )\n", | ||
"\n", | ||
" transformer = new_transformer\n", | ||
" \n", | ||
" self.wait(2) # Pause before next loop iteration\n", | ||
"\n", | ||
" self.play(*[FadeOut(mob) for mob in self.mobjects])\n", | ||
" self.wait(2) \n", | ||
"\n", | ||
"import random\n", | ||
"\n", | ||
"def random_shape(current_shape_class):\n", | ||
" shapes = [Circle, Square, Triangle]\n", | ||
" available_shapes = [shape for shape in shapes if shape != current_shape_class]\n", | ||
" return random.choice(available_shapes)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "0e8248f9-60d1-4bae-9241-8a23978aa137", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Manim Community <span style=\"color: #008000; text-decoration-color: #008000\">v0.18.0</span>\n", | ||
"\n", | ||
"</pre>\n" | ||
], | ||
"text/plain": [ | ||
"Manim Community \u001b[32mv0.\u001b[0m\u001b[32m18.0\u001b[0m\n", | ||
"\n" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
}, | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Usage: manim render [OPTIONS] FILE [SCENE_NAMES]...\n", | ||
"\n", | ||
" Render SCENE(S) from the input FILE.\n", | ||
"\n", | ||
" FILE is the file path of the script or a config file.\n", | ||
"\n", | ||
" SCENES is an optional list of scenes in the file.\n", | ||
"\n", | ||
"Global options:\n", | ||
" -c, --config_file TEXT Specify the configuration file to use for\n", | ||
" render settings.\n", | ||
" --custom_folders Use the folders defined in the [custom_folders]\n", | ||
" section of the config file to define the output\n", | ||
" folder structure.\n", | ||
" --disable_caching Disable the use of the cache (still generates\n", | ||
" cache files).\n", | ||
" --flush_cache Remove cached partial movie files.\n", | ||
" --tex_template TEXT Specify a custom TeX template file.\n", | ||
" -v, --verbosity [DEBUG|INFO|WARNING|ERROR|CRITICAL]\n", | ||
" Verbosity of CLI output. Changes ffmpeg log\n", | ||
" level unless 5+.\n", | ||
" --notify_outdated_version / --silent\n", | ||
" Display warnings for outdated installation.\n", | ||
" --enable_gui Enable GUI interaction.\n", | ||
" --gui_location TEXT Starting location for the GUI.\n", | ||
" --fullscreen Expand the window to its maximum possible size.\n", | ||
" --enable_wireframe Enable wireframe debugging mode in opengl.\n", | ||
" --force_window Force window to open when using the opengl\n", | ||
" renderer, intended for debugging as it may\n", | ||
" impact performance\n", | ||
" --dry_run Renders animations without outputting image or\n", | ||
" video files and disables the window\n", | ||
" --no_latex_cleanup Prevents deletion of .aux, .dvi, and .log files\n", | ||
" produced by Tex and MathTex.\n", | ||
"\n", | ||
"Output options:\n", | ||
" -o, --output_file TEXT Specify the filename(s) of the rendered\n", | ||
" scene(s).\n", | ||
" -0, --zero_pad INTEGER RANGE Zero padding for PNG file names. [0<=x<=9]\n", | ||
" --write_to_movie Write the video rendered with opengl to a file.\n", | ||
" --media_dir PATH Path to store rendered videos and latex.\n", | ||
" --log_dir PATH Path to store render logs.\n", | ||
" --log_to_file Log terminal output to file.\n", | ||
"\n", | ||
"Render Options:\n", | ||
" -n, --from_animation_number TEXT\n", | ||
" Start rendering from n_0 until n_1. If n_1 is\n", | ||
" left unspecified, renders all scenes after n_0.\n", | ||
" -a, --write_all Render all scenes in the input file.\n", | ||
" --format [png|gif|mp4|webm|mov]\n", | ||
" -s, --save_last_frame Render and save only the last frame of a scene\n", | ||
" as a PNG image.\n", | ||
" -q, --quality [l|m|h|p|k] Render quality at the follow resolution\n", | ||
" framerates, respectively: 854x480 15FPS,\n", | ||
" 1280x720 30FPS, 1920x1080 60FPS, 2560x1440\n", | ||
" 60FPS, 3840x2160 60FPS\n", | ||
" -r, --resolution TEXT Resolution in \"W,H\" for when 16:9 aspect ratio\n", | ||
" isn't possible.\n", | ||
" --fps, --frame_rate FLOAT Render at this frame rate.\n", | ||
" --renderer [cairo|opengl] Select a renderer for your Scene.\n", | ||
" -g, --save_pngs Save each frame as png (Deprecated).\n", | ||
" -i, --save_as_gif Save as a gif (Deprecated).\n", | ||
" --save_sections Save section videos in addition to movie file.\n", | ||
" -t, --transparent Render scenes with alpha channel.\n", | ||
" --use_projection_fill_shaders Use shaders for OpenGLVMobject fill which are\n", | ||
" compatible with transformation matrices.\n", | ||
" --use_projection_stroke_shaders\n", | ||
" Use shaders for OpenGLVMobject stroke which are\n", | ||
" compatible with transformation matrices.\n", | ||
"\n", | ||
"Ease of access options:\n", | ||
" --progress_bar [display|leave|none]\n", | ||
" Display progress bars and/or keep them\n", | ||
" displayed.\n", | ||
" -p, --preview Preview the Scene's animation. OpenGL does a\n", | ||
" live preview in a popup window. Cairo opens the\n", | ||
" rendered video file in the system default media\n", | ||
" player.\n", | ||
" -f, --show_in_file_browser Show the output file in the file browser.\n", | ||
" --jupyter Using jupyter notebook magic.\n", | ||
"\n", | ||
"Other options:\n", | ||
" --help Show this message and exit.\n", | ||
"\n", | ||
"Made with <3 by Manim Community developers.\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%manim render --help\n", | ||
"\n", | ||
"pass" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1c3e55a1-9b84-4119-a2dc-55f440d0a7d1", | ||
"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.11.9" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Binary file not shown.
Binary file modified
BIN
+1.16 KB
(100%)
src/notebook/media/videos/notebook/480p30/ImpredicativityAnimation.mp4
Binary file not shown.
Binary file removed
BIN
-49.9 KB
src/notebook/media/videos/notebook/480p30/LayeredGraphProjection.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.