- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.5k
 
Bunch of more examples for the docs #458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            35 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      8b9a40f
              
                #added some examples to the camera scene
              
              
                kolibril13 219c8f6
              
                #added 3 ZoomedScene examples
              
              
                kolibril13 e962187
              
                #removed accidentally added files
              
              
                kolibril13 ab0b262
              
                #added updater examples
              
              
                kolibril13 f207cba
              
                #added text examples
              
              
                kolibril13 ff6ef7b
              
                #renamed example
              
              
                kolibril13 2e0df50
              
                #added 3d example with other light source
              
              
                kolibril13 494e57c
              
                #added imagemobject examples
              
              
                kolibril13 b932504
              
                # added one line of code
              
              
                kolibril13 29c1539
              
                # small fix
              
              
                kolibril13 436ea3c
              
                # added 3d examples
              
              
                kolibril13 2e32d96
              
                # added one advanced project
              
              
                kolibril13 58b4233
              
                fixed error
              
              
                kolibril13 ee0c1c3
              
                small changes
              
              
                kolibril13 3e8145e
              
                3d render
              
              
                kolibril13 0ce2ba1
              
                another idea with the file 3d_fix.rst
              
              
                kolibril13 69b8670
              
                Merge branch 'master' into more_for_docs
              
              
                kolibril13 38fa13d
              
                # one more change
              
              
                kolibril13 2978804
              
                some more formula examples
              
              
                kolibril13 9305baf
              
                fix indent
              
              
                kolibril13 f5aa9a0
              
                remove reference to examples/3d_fix
              
              
                behackl 0673f1d
              
                change default resolution for videos in doc to 480p30
              
              
                behackl 40ae5d7
              
                Apply suggestions leotrs
              
              
                kolibril13 7ad3136
              
                Added credits and 3d scene changes
              
              
                kolibril13 0ef8427
              
                # removed unnecessary lines
              
              
                kolibril13 db8cd79
              
                # implemented lots of changes suggested be leotrs
              
              
                kolibril13 69737f8
              
                # updated credits
              
              
                kolibril13 6f1f19f
              
                # updated scene names
              
              
                kolibril13 834aba5
              
                Update docs/source/examples/shapes.rst
              
              
                kolibril13 53ec42d
              
                updated credits
              
              
                kolibril13 03e8312
              
                updated examples entery
              
              
                kolibril13 1aad7e6
              
                Update camera_settings.rst
              
              
                kolibril13 01f07d2
              
                changed two lines
              
              
                kolibril13 093be8e
              
                Update shapes.rst
              
              
                kolibril13 82aea6b
              
                Update plots.rst
              
              
                kolibril13 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or 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 hidden or 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 hidden or 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 | 
|---|---|---|
| @@ -1,4 +1,91 @@ | ||
| Advanced Projects | ||
| ================================= | ||
| 
     | 
||
| This page is currently under construction. It will feature a selection of advanced projects built with manim. | ||
| .. manim:: ExampleSineCurve | ||
| 
     | 
||
| class ExampleSineCurve(Scene): | ||
| # contributed by heejin_park, https://infograph.tistory.com/230 | ||
| def construct(self): | ||
| self.show_axis() | ||
| self.show_circle() | ||
| self.move_dot_and_draw_curve() | ||
| self.wait() | ||
| 
     | 
||
| def show_axis(self): | ||
| x_start = np.array([-6,0,0]) | ||
| x_end = np.array([6,0,0]) | ||
| 
     | 
||
| y_start = np.array([-4,-2,0]) | ||
| y_end = np.array([-4,2,0]) | ||
| 
     | 
||
| x_axis = Line(x_start, x_end) | ||
| y_axis = Line(y_start, y_end) | ||
| 
     | 
||
| self.add(x_axis, y_axis) | ||
| self.add_x_labels() | ||
                
      
                  kolibril13 marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| self.orgin_point = np.array([-4,0,0]) | ||
| self.curve_start = np.array([-3,0,0]) | ||
| 
     | 
||
| def add_x_labels(self): | ||
| x_labels = [ | ||
| TexMobject("\pi"), TexMobject("2 \pi"), | ||
| TexMobject("3 \pi"), TexMobject("4 \pi"), | ||
| ] | ||
| 
     | 
||
| for i in range(len(x_labels)): | ||
| x_labels[i].next_to(np.array([-1 + 2*i, 0, 0]), DOWN) | ||
| self.add(x_labels[i]) | ||
| 
     | 
||
| def show_circle(self): | ||
| circle = Circle(radius=1) | ||
| circle.move_to(self.orgin_point) | ||
| 
     | 
||
| self.add(circle) | ||
| self.circle = circle | ||
| 
     | 
||
| def move_dot_and_draw_curve(self): | ||
| orbit = self.circle | ||
| orgin_point = self.orgin_point | ||
| 
     | 
||
| dot = Dot(radius=0.08, color=YELLOW) | ||
| dot.move_to(orbit.point_from_proportion(0)) | ||
| self.t_offset = 0 | ||
| rate = 0.25 | ||
| 
     | 
||
| def go_around_circle(mob, dt): | ||
| self.t_offset += (dt * rate) | ||
| # print(self.t_offset) | ||
                
      
                  kolibril13 marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| mob.move_to(orbit.point_from_proportion(self.t_offset % 1)) | ||
| 
     | 
||
| def get_line_to_circle(): | ||
| return Line(orgin_point, dot.get_center(), color=BLUE) | ||
| 
     | 
||
| def get_line_to_curve(): | ||
| x = self.curve_start[0] + self.t_offset * 4 | ||
| y = dot.get_center()[1] | ||
| return Line(dot.get_center(), np.array([x,y,0]), color=YELLOW_A, stroke_width=2 ) | ||
                
      
                  kolibril13 marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| 
     | 
||
                
      
                  kolibril13 marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| self.curve = VGroup() | ||
| self.curve.add(Line(self.curve_start,self.curve_start)) | ||
                
      
                  kolibril13 marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| def get_curve(): | ||
| last_line = self.curve[-1] | ||
| x = self.curve_start[0] + self.t_offset * 4 | ||
| y = dot.get_center()[1] | ||
| new_line = Line(last_line.get_end(),np.array([x,y,0]), color=YELLOW_D) | ||
                
      
                  kolibril13 marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| self.curve.add(new_line) | ||
| 
     | 
||
| return self.curve | ||
| 
     | 
||
| dot.add_updater(go_around_circle) | ||
| 
     | 
||
| origin_to_circle_line = always_redraw(get_line_to_circle) | ||
| dot_to_curve_line = always_redraw(get_line_to_curve) | ||
| sine_curve_line = always_redraw(get_curve) | ||
| 
     | 
||
| self.add(dot) | ||
| self.add(orbit, origin_to_circle_line, dot_to_curve_line, sine_curve_line) | ||
| self.wait(8.5) | ||
| 
     | 
||
| dot.remove_updater(go_around_circle) | ||
  
    
      This file contains hidden or 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 hidden or 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
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.