Skip to content

Instantly share code, notes, and snippets.

@behackl
Created November 1, 2021 20:26
Show Gist options
  • Save behackl/39c111107de4db977355ecf57495655c to your computer and use it in GitHub Desktop.
Save behackl/39c111107de4db977355ecf57495655c to your computer and use it in GitHub Desktop.
[Manimation] Complex exponential function
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "37949a6d-b53d-4617-884f-b8476ab7b5e8",
"metadata": {},
"outputs": [],
"source": [
"from manim import *\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "987b656b-13c1-4a50-a641-5144de22dcda",
"metadata": {},
"outputs": [],
"source": [
"config.media_width = \"80%\"\n",
"config.verbosity = \"WARNING\"\n",
"config.background_color = \"#ece6e2\"\n",
"\n",
"ThreeDAxes.set_default(axis_config={\"color\": BLACK})\n",
"ParametricFunction.set_default(color=BLACK)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bfd8317c-a402-4622-b4e8-8d567102cb87",
"metadata": {},
"outputs": [],
"source": [
"%%manim -qm ComplexExp\n",
"\n",
"class ComplexExp(ThreeDScene):\n",
" def construct(self):\n",
" axes = ThreeDAxes(x_range=(-0.1, 4.25), y_range=(-1.5, 1.5), z_range=(-1.5, 1.5), y_length=4, z_length=4)\n",
" curve = ParametricFunction(\n",
" lambda p: axes.coords_to_point(p, np.cos(PI*p), np.sin(PI*p)),\n",
" t_range=(0, 4, 0.1)\n",
" )\n",
" self.set_camera_orientation(phi=75*DEGREES, theta=-30*DEGREES)\n",
" self.add(axes)\n",
" self.play(Create(curve))\n",
" self.wait()\n",
" self.move_camera(phi=90*DEGREES, theta=-90*DEGREES, focal_distance=100)\n",
" self.wait()\n",
" self.move_camera(phi=75*DEGREES, theta=-30*DEGREES)\n",
" self.wait()\n",
" self.move_camera(phi=0, theta=-90*DEGREES, focal_distance=100)\n",
" self.wait()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "94c2757d-a735-47e9-b1bd-eba7fdb7cba7",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
FROM manimcommunity/manim:v0.11.0
COPY --chown=manimuser:manimuser . /manim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment