mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Merge branch 'master' into holomorphic
This commit is contained in:
commit
c5df669f90
4 changed files with 20 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
|||
# Manim
|
||||
Animation engine for explanatory math videos.
|
||||
|
||||
For those who want to play around with this tool, I should be upfront that I've mostly had my own use cases (i.e. 3b1b videos) in mind while building it, and it might not be the most friendly thing to get up and running. In particular, I have not done a great job tracking requirements, and documentation, to put it euphamistically, almost exclusively takes the form of naming conventions.
|
||||
For those who want to play around with this tool, I should be upfront that I've mostly had my own use cases (i.e. 3b1b videos) in mind while building it, and it might not be the most friendly thing to get up and running. In particular, I have not done a great job tracking requirements, and documentation, to put it euphemistically, almost exclusively takes the form of naming conventions.
|
||||
|
||||
For 9/10 math animation needs, you'd probably be better off using a more well-maintained tool, like matplotlib, mathematica or even going a non-programatic route with something like After Effects. I also happen to think the program "Grapher" built into osx is really great, and surprisingly versatile for many needs. My own reasons for building this tool and using it for videos are twofold, and I'm not sure how well they apply to other people's use cases.
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ class ApplyMatrix(ApplyPointwiseFunction):
|
|||
new_matrix[:2, :2] = matrix
|
||||
matrix = new_matrix
|
||||
elif matrix.shape != (3, 3):
|
||||
raise "Matrix has bad dimensions"
|
||||
raise Exception("Matrix has bad dimensions")
|
||||
transpose = np.transpose(matrix)
|
||||
|
||||
def func(p):
|
||||
|
|
|
@ -93,12 +93,14 @@ class ExamplesOfOneDimensionalLinearTransforms(ShowMultiplication):
|
|||
|
||||
class ExamplesOfNonlinearOneDimensionalTransforms(NumberLineScene):
|
||||
def construct(self):
|
||||
def sinx_plux_x(xxx_todo_changeme):
|
||||
(x, y, z) = xxx_todo_changeme
|
||||
def sinx_plux_x(x_y_z):
|
||||
(x, y, z) = x_y_z
|
||||
return (np.sin(x) + 1.2*x, y, z)
|
||||
def shift_zero(xxx_todo_changeme2):
|
||||
(x, y, z) = xxx_todo_changeme2
|
||||
|
||||
def shift_zero(x_y_z):
|
||||
(x, y, z) = x_y_z
|
||||
return (2*x+4, y, z)
|
||||
|
||||
self.nonlinear = TextMobject("Not a Linear Transform")
|
||||
self.nonlinear.set_color(LIGHT_RED).to_edge(UP, buff = 1.5)
|
||||
pairs = [
|
||||
|
@ -295,12 +297,14 @@ class ExamplesOfTwoDimensionalLinearTransformations(ShowMatrixTransform):
|
|||
class ExamplesOfNonlinearTwoDimensionalTransformations(Scene):
|
||||
def construct(self):
|
||||
Scene.construct(self)
|
||||
def squiggle(xxx_todo_changeme3):
|
||||
(x, y, z) = xxx_todo_changeme3
|
||||
def squiggle(x_y_z):
|
||||
(x, y, z) = x_y_z
|
||||
return (x+np.sin(y), y+np.cos(x), z)
|
||||
def shift_zero(xxx_todo_changeme4):
|
||||
(x, y, z) = xxx_todo_changeme4
|
||||
|
||||
def shift_zero(x_y_z):
|
||||
(x, y, z) = x_y_z
|
||||
return (2*x + 3*y + 4, -1*x+y+2, z)
|
||||
|
||||
self.nonlinear = TextMobject("Nonlinear Transform")
|
||||
self.nonlinear.set_color(LIGHT_RED)
|
||||
self.nonlinear.to_edge(UP, buff = 1.5)
|
||||
|
@ -386,12 +390,13 @@ class TrickyExamplesOfNonlinearTwoDimensionalTransformations(Scene):
|
|||
UP*FRAME_Y_RADIUS+RIGHT*FRAME_X_RADIUS,
|
||||
density = 10*DEFAULT_POINT_DENSITY_1D
|
||||
)
|
||||
def sunrise(xxx_todo_changeme5):
|
||||
(x, y, z) = xxx_todo_changeme5
|
||||
|
||||
def sunrise(x_y_z):
|
||||
(x, y, z) = x_y_z
|
||||
return ((FRAME_Y_RADIUS+y)*x, y, z)
|
||||
|
||||
def squished(xxx_todo_changeme6):
|
||||
(x, y, z) = xxx_todo_changeme6
|
||||
def squished(x_y_z):
|
||||
(x, y, z) = x_y_z
|
||||
return (x + np.sin(x), y+np.sin(y), z)
|
||||
|
||||
self.get_blackness()
|
||||
|
|
|
@ -432,7 +432,7 @@ class LinearTransformationScene(VectorScene):
|
|||
new_matrix[:2, :2] = transposed_matrix
|
||||
transposed_matrix = new_matrix
|
||||
elif transposed_matrix.shape != (3, 3):
|
||||
raise "Matrix has bad dimensions"
|
||||
raise Exception("Matrix has bad dimensions")
|
||||
return lambda point: np.dot(point, transposed_matrix)
|
||||
|
||||
def get_piece_movement(self, pieces):
|
||||
|
|
Loading…
Add table
Reference in a new issue