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
from manim import * | |
class sinxsiny(Scene): | |
def construct(self): | |
O = Dot([-3,-3.0,0], color=YELLOW, radius=0.05) | |
A = Dot([3,-3.0,0], color=YELLOW, radius=0.05) | |
lbl_O = MathTex(r"O").next_to(O,LEFT) | |
lbl_A = MathTex(r"A").next_to(A,RIGHT) | |
x = 35*DEGREES | |
y = 20*DEGREES |
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
''' | |
In a zoomed scene the outline stroke of the zoomed rectangular frame protrudes into the zoomed view at high magnification | |
''' | |
class ZoomPractice(ZoomedScene): | |
def construct(self): | |
ax = NumberPlane( | |
x_range=[0, 10, 5], | |
y_range=[0, 150, 50], | |
x_length=12, | |
y_length=12, |
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
class connectTheDots(Scene): | |
def construct(self): | |
xvals = [np.random.uniform(-6.5,6.5) for _ in range(20)] | |
yvals = [np.random.uniform(-3.5,3.5) for _ in range(20)] | |
colors = [np.random.choice([RED,GREEN,BLUE,YELLOW,MAROON,ORANGE,WHITE]) for _ in range(20)] | |
dots = VGroup( | |
*[Dot(point=[x,y,0], color=c) for x,y,c in zip(xvals,yvals,colors)] | |
) | |
self.add(dots) |
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
# https://discord.com/channels/581738731934056449/1290678443905650819/1290678443905650819 | |
from manim import * | |
class autozoom(MovingCameraScene): | |
def construct(self): | |
sq = Square() | |
circ = Circle() | |
self.add(sq,circ) | |
self.add(self.camera.frame) |
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
# https://discord.com/channels/581738731934056449/976376734935048223/1161709114154569819 | |
# https://www.youtube.com/watch?v=Bg999qefIic | |
def ir(a,b): # inclusive range, useful for TransformByGlyphMap | |
return list(range(a,b+1)) | |
class TransformByGlyphMap(AnimationGroup): | |
def __init__(self, mobA, mobB, *glyph_map, replace=True, from_copy=False, show_indices=False, **kwargs): | |
# replace=False does not work properly |
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
from manim import * | |
# https://discord.com/channels/581738731934056449/753938743366254642/1280965870239223920 | |
class Test(Scene): | |
def construct(self): | |
ax1 = Axes( | |
x_range=[-1, 7, 10], | |
y_range=[0, 6, 10], | |
x_length=6, | |
y_length=5 | |
).add_coordinates() |
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
from manim import * | |
# https://discord.com/channels/581738731934056449/753938743366254642/1280962332469624953 | |
class Test(Scene): | |
def construct(self): | |
ax1 = Axes( | |
x_range=[-1, 7, 10], | |
y_range=[0, 6, 10], | |
x_length=6, | |
y_length=5 | |
).add_coordinates() |
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
from manim import * | |
class plotter(Scene): | |
def construct(self): | |
def func(x): | |
return 2*np.sin(x) | |
ax = Axes() | |
pl1 = ax.plot(func) | |
pl2 = ax.plot( | |
lambda x: 2*np.cos(x) |
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
from manim import * | |
class circles(Scene): | |
def construct(self): | |
vt = ValueTracker(1) | |
def mobfunc(): | |
return Circle(radius=vt.get_value(), color=BLUE).shift(3*LEFT) | |
circ1 = always_redraw(mobfunc) | |
circ2 = always_redraw(lambda: |
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
# https://discord.com/channels/581738731934056449/1271400215525724162/1271400215525724162 | |
from manim import * | |
class cplxNumber(Scene): | |
def construct(self): | |
ax = ComplexPlane().add_coordinates() | |
self.add(ax) | |
ctr = ComplexValueTracker(1+1j) | |
cdisp = always_redraw(lambda: | |
VGroup( |