Skip to content

Instantly share code, notes, and snippets.

@jaddoescad
jaddoescad / Intro.py
Last active March 12, 2019 02:12
Intro to course
from big_ol_pile_of_manim_imports import *
#
def set_background(self):
background = Rectangle(
width = FRAME_WIDTH,
height = FRAME_HEIGHT,
stroke_width = 0,
fill_color = "#364658",
fill_opacity = 1)
@jaddoescad
jaddoescad / move_word.py
Created March 10, 2019 23:12
move word
class Move_word_from_one_sentence_to_the_other(Scene):
def construct(self):
kwargs = {
"tex_to_color_map": {
"circumference": RED,
}
}
question = TextMobject(
"""
\\small
@jaddoescad
jaddoescad / vector_field.py
Created March 10, 2019 18:55
Create Vector Field
from big_ol_pile_of_manim_imports import *
class SimpleField(Scene):
CONFIG = {
"plane_kwargs" : {
"color" : RED}}
def construct(self):
plane = NumberPlane(**self.plane_kwargs) #Create axes and grid
plane.add(plane.get_axis_labels()) #add x and y label
@jaddoescad
jaddoescad / draw_axis.py
Created March 10, 2019 18:51
draw axis with manim
from big_ol_pile_of_manim_imports import *
class DrawAnAxis(Scene):
CONFIG = { "plane_kwargs" : {
"x_line_frequency" : 2,
"y_line_frequency" :2
}
}
def construct(self):
@jaddoescad
jaddoescad / ExampleApproximation.py
Created March 10, 2019 18:01
example approximation
from big_ol_pile_of_manim_imports import *
class ExampleApproximation(GraphScene):
CONFIG = {
"function" : lambda x : np.cos(x),
"function_color" : BLUE,
"taylor" : [lambda x: 1, lambda x: 1-x**2/2, lambda x: 1-x**2/math.factorial(2)+x**4/math.factorial(4), lambda x: 1-x**2/2+x**4/math.factorial(4)-x**6/math.factorial(6),
lambda x: 1-x**2/math.factorial(2)+x**4/math.factorial(4)-x**6/math.factorial(6)+x**8/math.factorial(8), lambda x: 1-x**2/math.factorial(2)+x**4/math.factorial(4)-x**6/math.factorial(6)+x**8/math.factorial(8) - x**10/math.factorial(10)],
"center_point" : 0,
"approximation_color" : GREEN,
from big_ol_pile_of_manim_imports import *
class PlotFunctions(GraphScene):
CONFIG = {
"x_min" : -10,
"x_max" : 10,
"y_min" : -1.5,
"y_max" : 1.5,
"graph_origin" : ORIGIN ,
"function_color" : RED ,
from big_ol_pile_of_manim_imports import *
class UsingBraces(Scene):
#Using braces to group text together
def construct(self):
eq1A = TextMobject("4x + 3y")
eq1B = TextMobject("=")
eq1C = TextMobject("0")
eq2A = TextMobject("5x -2y")
eq2B = TextMobject("=")
@jaddoescad
jaddoescad / coloringequations.py
Created March 10, 2019 17:15
coloringequations
class ColoringEquations(Scene):
#Grouping and coloring parts of equations
def construct(self):
line1=TexMobject(r"\text{The vector } \vec{F}_{net} \text{ is the net }",r"\text{force }",r"\text{on object of mass }")
line1.set_color_by_tex("force", BLUE)
line2=TexMobject("m", "\\text{ and acceleration }", "\\vec{a}", ". ")
line2.set_color_by_tex_to_color_map({
"m": YELLOW,
"{a}": RED
})
@jaddoescad
jaddoescad / basic_equation.py
Created March 10, 2019 17:00
Basic equation manim
from big_ol_pile_of_manim_imports import *
class BasicEquations(Scene):
#A short script showing how to use Latex commands
def construct(self):
eq1=TextMobject("$\\vec{X}_0 \\cdot \\vec{Y}_1 = 3$")
eq1.shift(2*UP)
eq2=TexMobject(r"\vec{F}_{net} = \sum_i \vec{F}_i")
eq2.shift(2*DOWN)
@jaddoescad
jaddoescad / highlight_text.py
Created March 10, 2019 16:58
Highlight Text
from big_ol_pile_of_manim_imports import *
class RotateAndHighlight(Scene):
#Rotation of text and highlighting with surrounding geometries
def construct(self):
square=Square(side_length=5,fill_color=YELLOW, fill_opacity=1)
label=TextMobject("Text at an angle")
label.bg=BackgroundRectangle(label,fill_opacity=1)
label_group=VGroup(label.bg,label) #Order matters
label_group.rotate(TAU/8)