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 Atom(Dot): | |
| def __init__(self, pos=ORIGIN, color = RED, prob = 0.1): | |
| super().__init__(point=pos, radius=.07, stroke_width=0, fill_opacity=1, color=color) | |
| self.prob = prob | |
| self.add_updater(self.updater) | |
| def updater(self,mobj,dt): | |
| if (self.prob > 0) and (np.random.uniform(0,1) <= self.prob*dt): | |
| self.prob = 0 |
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 manadala(Scene): | |
| def construct(self): | |
| center = Dot() | |
| tri = RegularPolygon(n=3, radius=0.5).rotate(PI, about_point=ORIGIN) | |
| circ = Circle(radius = 1) | |
| petarc = VMobject().set_anchors_and_handles( | |
| [np.cos(PI/8),np.sin(PI/8),0], | |
| [1.5*np.cos(PI/8),1.5*np.sin(PI/8),0], |
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 tile(Scene): | |
| def construct(self): | |
| for _ in range(10): | |
| # Size rectangleSize = new Size(); # rectangle size will be used as a default value that is the exact aspect ratio desired. | |
| # | |
| # Aspect Ratio = h / w | |
| # where h is the height of the child and w is the width | |
| # | |
| # the numerator will be the aspect ratio and the denominator will always be one | |
| # if you want it to be square just use an aspect ratio of 1 |
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 Planet(VMobject): | |
| def __init__(self, | |
| sun:VMobject=None, | |
| ax:CoordinateSystem=None, | |
| color = BLUE, | |
| radius =0.1, | |
| mass = 6e24, | |
| pos = np.array([150e9,0,0]), | |
| vel = np.array([0,30e3,0]), | |
| G = 6.67e-11, |
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
| import wave | |
| import struct | |
| class increaseFreq(Scene): | |
| def construct(self): | |
| fsamp = 44.1e3 | |
| f0 = 440 | |
| f1 = 880 | |
| time = 3 | |
| ts = np.linspace(start = 0, stop = time, num=int(fsamp*time)) | |
| def f(t): |
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 Disc(VMobject): | |
| def __init__(self, color=RED, width=2, height=0.5): | |
| super().__init__(fill_color=color, fill_opacity=0.9, stroke_color=color, stroke_opacity=1, stroke_width=3) | |
| obj = Union( | |
| Circle(radius=height/2).shift([-width/2+height/2,0,0]), | |
| Rectangle(width=width-height,height=height), | |
| Circle(radius=height/2).shift([+width/2-height/2,0,0]), |
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 PIL.Image import Resampling | |
| class doesthiswork2(Scene): | |
| def construct(self): | |
| vpixels = 40 | |
| svg = VGroup( | |
| Circle(), | |
| Text("Test") | |
| ) | |
| oheight = svg.height | |
| svg.scale_to_fit_height(8/(config.pixel_height/vpixels),scale_stroke=True) |
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 * | |
| import manifold3d as mf3 | |
| class spherical(ThreeDScene): | |
| def construct(self): | |
| self.set_camera_orientation(phi=70 * DEGREES, theta=-70 * DEGREES) | |
| sp = mf3.Manifold.sphere(radius =2, circular_segments=24) | |
| verts = sp.to_mesh().vert_properties | |
| manimsphere = VGroup( |
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 AnalogMeter(VGroup): | |
| def __init__(self, | |
| value = 0, | |
| width=4, | |
| height=3.5, | |
| corner_radius=0.5, | |
| outer_stroke_width=5, | |
| outer_stroke_color=GRAY, |
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 MF_Tools import TransformByGlyphMap | |
| class benzeneAnim(Scene): | |
| def construct(self): | |
| mol1 = Tex( | |
| r"\chemfig{*6(-=-=-=)}", | |
| tex_template=myChemTemplate | |
| ).set_stroke(width=3) | |
| mol2 = Tex( | |
| r"\chemfig{*6(--=-(=O)-=)}", | |
| tex_template=myChemTemplate |
NewerOlder