Advertisement
Guest User

Untitled

a guest
May 25th, 2024
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.28 KB | None | 0 0
  1. from manim import *
  2. import numpy as np
  3.  
  4. class atomAbsorbsHeat(Scene):
  5.     def get_sine_wave(self,dx=0):
  6.         return FunctionGraph\
  7.                 (
  8.                     lambda x: 0.1*np.sin((12*x+dx)),
  9.                     color = YELLOW,
  10.                     x_range=[-3, 3]
  11.                 )
  12.  
  13.     def construct(self):
  14.         photon = self.get_sine_wave()
  15.         d_theta = ValueTracker(0)
  16.         def updateWave(func):
  17.             func.become\
  18.                     (
  19.                         self.get_sine_wave(dx=d_theta.get_value())
  20.                     )
  21.             return func
  22.         photon.add_updater(updateWave)
  23.         photon.rotate(PI/2)
  24.  
  25.         nucleus = Circle(radius=0.5, color=RED, fill_opacity=1)
  26.  
  27.         electron = Circle(radius=0.1, color=BLUE, fill_opacity=1).shift(2*RIGHT) #next_to(nucleus,2*RIGHT)
  28.  
  29.         orbit1 = Circle(radius=2, color=BLUE_A,stroke_width=1)
  30.  
  31.         orbit2 = Circle(radius=3.3, color=BLUE_A, stroke_width=1)
  32.  
  33.         test = Line(start=LEFT,end=RIGHT,color=YELLOW)
  34.  
  35.         everything = VGroup(nucleus,orbit1,orbit2,electron,photon)
  36.  
  37.         self.add(everything)
  38.         #self.play(FadeIn(everything))
  39.         self.play(photon.animate.rotate(PI/2))
  40.         self.play(d_theta.animate.set_value(2*PI*-10))
  41.         self.wait()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement