Merge branch 'master' of https://github.com/3b1b/manim into WindingNumber

This commit is contained in:
Sridhar Ramesh 2018-02-26 16:01:49 -08:00
commit 07214127d8
7 changed files with 2129 additions and 27 deletions

View file

@ -394,7 +394,7 @@ class Camera(object):
y0 = max(y0, 0)
image[y0:y1, x0:x1] = stretched_impa[siy0:siy1, six0:six1]
else:
# Alternate (slower) tactice if image is tilted
# Alternate (slower) tactic if image is tilted
# List of all coordinates of pixels, given as (x, y),
# which matches the return type of points_to_pixel_coords,
# even though np.array indexing naturally happens as (y, x)
@ -618,7 +618,7 @@ class MovingCamera(Camera):
def capture_mobjects(self, *args, **kwargs):
self.space_center = self.mobject.get_center()
self.realign_space_shape()
self.realign_space_shape()
Camera.capture_mobjects(self, *args, **kwargs)
def realign_space_shape(self):

View file

@ -29,6 +29,8 @@ class ImageMobject(Mobject):
else:
self.pixel_array = np.array(filename_or_array)
self.change_to_rgba_array()
if self.invert:
self.pixel_array[:,:,:3] = 255-self.pixel_array[:,:,:3]
Mobject.__init__(self, **kwargs)
def change_to_rgba_array(self):

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,23 @@
from helpers import *
from camera import MovingCamera
from scene import Scene
from topics.geometry import ScreenRectangle
class MovingCameraScene(Scene):
def setup(self):
self.camera_frame = ScreenRectangle(height = 2*SPACE_HEIGHT)
self.camera_frame.set_stroke(width = 0)
self.camera = MovingCamera(
self.camera_frame, **self.camera_config
)
return self
def get_moving_mobjects(self, *animations):
# TODO: Code repetition from ZoomedScene
moving_mobjects = Scene.get_moving_mobjects(self, *animations)
if self.camera_frame in moving_mobjects:
# When the camera is moving, so is everything,
return self.mobjects
else:
return moving_mobjects

View file

@ -122,6 +122,7 @@ class ZoomedScene(Scene):
self.zoomed_camera.capture_mobjects(
mobjects, **kwargs
)
def get_moving_mobjects(self, *animations):
moving_mobjects = Scene.get_moving_mobjects(self, *animations)
if self.zoom_activated and self.little_rectangle in moving_mobjects:

View file

@ -575,6 +575,7 @@ class PiCreatureScene(Scene):
time_to_blink = self.total_wait_time%self.seconds_to_blink == 0
if blink and self.any_pi_creatures_on_screen() and time_to_blink:
self.blink()
self.num_plays -= 1 #This shouldn't count as an animation
else:
self.non_blink_wait()
time -= 1