Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from manim import *
- import numpy as np
- class atomAbsorbsHeat(Scene):
- def get_sine_wave(self,dx=0):
- return FunctionGraph\
- (
- lambda x: 0.1*np.sin((12*x+dx)),
- color = YELLOW,
- x_range=[-3, 3]
- )
- def construct(self):
- photon = self.get_sine_wave()
- d_theta = ValueTracker(0)
- def updateWave(func):
- func.become\
- (
- self.get_sine_wave(dx=d_theta.get_value())
- )
- return func
- photon.add_updater(updateWave)
- photon.rotate(PI/2)
- nucleus = Circle(radius=0.5, color=RED, fill_opacity=1)
- electron = Circle(radius=0.1, color=BLUE, fill_opacity=1).shift(2*RIGHT) #next_to(nucleus,2*RIGHT)
- orbit1 = Circle(radius=2, color=BLUE_A,stroke_width=1)
- orbit2 = Circle(radius=3.3, color=BLUE_A, stroke_width=1)
- everything = VGroup(nucleus,orbit1,orbit2,electron,photon)
- self.play(FadeIn(everything))
- self.play(d_theta.animate.set_value(2*PI*-10))
- self.wait()
Advertisement
Comments
-
- class atomAbsorbsHeat(Scene):
- def get_sine_wave(self,dx=0):
- return FunctionGraph\
- (
- lambda x: 0.1*np.sin((12*x+dx)),
- color = YELLOW,
- x_range=[-3, 3]
- )
- def construct(self):
- photon = self.get_sine_wave()
- d_theta = ValueTracker(0)
- phi =ValueTracker(0)
- def updateWave(func):
- func.become\
- (
- self.get_sine_wave(dx=d_theta.get_value()).rotate(phi.get_value())
- )
- return func
- photon.add_updater(updateWave)
- nucleus = Circle(radius=0.5, color=RED, fill_opacity=1)
- electron = Circle(radius=0.1, color=BLUE, fill_opacity=1).shift(2*RIGHT) #next_to(nucleus,2*RIGHT)
- orbit1 = Circle(radius=2, color=BLUE_A,stroke_width=1)
- orbit2 = Circle(radius=3.3, color=BLUE_A, stroke_width=1)
- everything = VGroup(nucleus,orbit1,orbit2,electron,photon)
- self.play(FadeIn(everything))
- self.play(phi.animate.set_value(PI/2))
- self.play(d_theta.animate.set_value(2*PI*-10))
- self.wait()
Add Comment
Please, Sign In to add comment
Advertisement