Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Beginning Bell's and Waves projects

Grant Sandersonaf38dd10958f
diff --git a/bell.py b/bell.py
new file mode 100644
index 000000000..1efe1e2e5
--- /dev/null
+++ b/bell.py
@@ -0,0 +1,69 @@
+from helpers import *
+
+from mobject.tex_mobject import TexMobject
+from mobject import Mobject
+from mobject.image_mobject import ImageMobject
+from mobject.vectorized_mobject import *
+
+from animation.animation import Animation
+from animation.transform import *
+from animation.simple_animations import *
+from animation.playground import *
+from topics.geometry import *
+from topics.characters import *
+from topics.functions import *
+from topics.fractals import *
+from topics.number_line import *
+from topics.combinatorics import *
+from topics.numerals import *
+from topics.three_dimensions import *
+from topics.objects import *
+from topics.probability import *
+from topics.complex_numbers import *
+from scene import Scene
+from scene.reconfigurable_scene import ReconfigurableScene
+from scene.zoomed_scene import *
+from camera import Camera
+from mobject.svg_mobject import *
+from mobject.tex_mobject import *
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/waves.py b/waves.py
new file mode 100644
index 000000000..f84bd3567
--- /dev/null
+++ b/waves.py
@@ -0,0 +1,116 @@
+from helpers import *
+
+from mobject.tex_mobject import TexMobject
+from mobject import Mobject
+from mobject.image_mobject import ImageMobject
+from mobject.vectorized_mobject import *
+
+from animation.animation import Animation
+from animation.transform import *
+from animation.simple_animations import *
+from animation.continual_animation import ContinualAnimation
+from animation.playground import *
+from topics.geometry import *
+from topics.characters import *
+from topics.functions import *
+from topics.fractals import *
+from topics.number_line import *
+from topics.combinatorics import *
+from topics.numerals import *
+from topics.three_dimensions import *
+from topics.objects import *
+from topics.probability import *
+from topics.complex_numbers import *
+from scene import Scene
+from scene.reconfigurable_scene import ReconfigurableScene
+from scene.zoomed_scene import *
+from camera import Camera
+from mobject.svg_mobject import *
+from mobject.tex_mobject import *
+
+E_COLOR = BLUE
+M_COLOR = RED
+
+class OscillatingVector(ContinualAnimation):
+ CONFIG = {
+ "tail" : ORIGIN,
+ "frequency" : 1,
+ "A_x" : 1,
+ "A_y" : 0,
+ "phi_x" : 0,
+ "phi_y" : 0,
+ }
+ def setup(self):
+ self.vector = self.mobject
+
+ def update_mobject(self, dt):
+ f = self.frequency
+ t = self.total_time
+ angle = 2*np.pi*f*t
+ vect = np.array([
+ self.A_x*np.exp(complex(0, angle + self.phi_x)),
+ self.A_y*np.exp(complex(0, angle + self.phi_y)),
+ 0,
+ ]).real
+ self.vector.put_start_and_end_on(self.tail, self.tail+vect)
+
+
+class EMScene(Scene):
+ def construct(self):
+ pass
+
+
+class Test(Scene):
+ def construct(self):
+ E_vect = Vector(UP, color = E_COLOR)
+ wiggle = OscillatingVector(
+ E_vect,
+ A_x = 2,
+ A_y = 1,
+ phi_x = np.pi/2,
+ frequency = 0.5,
+ tail = UP+RIGHT,
+ )
+ randy = Randolph()
+
+ self.add(randy, wiggle)
+ self.dither(2)
+ self.play(FadeOut(E_vect))
+ self.dither(2)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+