Skip to content

Instantly share code, notes, and snippets.

View uwezi's full-sized avatar

Uwe Zimmermann uwezi

View GitHub Profile
@uwezi
uwezi / 20250524_bulleted.py
Last active May 24, 2025 20:13
[fancy bulleted list] A fancy bulleted list in Manim. #manim #animate #tex
from manim import *
# https://discord.com/channels/581738731934056449/1375396076231594045/1375396076231594045
class FancyBulletlist(VGroup):
def __init__(self, bulletobject=None, items=[], **kwargs):
super().__init__(**kwargs)
if bulletobject == None:
bulletobject = Dot()
self.items = items
@uwezi
uwezi / 20250510_tipped.py
Last active May 10, 2025 20:06
[better tipped lines] Adding a tip to a line without distorting it. #manim #line #tip
from manim import *
import manim.mobject.geometry.tips as tips
# https://discord.com/channels/581738731934056449/1370706466541011055/1370728872416514141
class reasonablyTipped(Scene):
def construct(self):
def add_tip(
line,
shorten=True,
@uwezi
uwezi / 20250218_planetary.py
Last active February 17, 2025 23:16
[Planetary gear] A planetary gear animation. #manim #animation #geometry #gears #mechanics
from manim_gearbox import *
class PlanetaryGears(Scene):
def construct(self):
# https://en.wikipedia.org/wiki/Epicyclic_gearing#Gear_speed_ratios_of_conventional_epicyclic_gearing
omegaplanet = 0.44
omegacarrier = 0.44*10/15
omegaring = (15+35)/35*omegacarrier
module = 0.15 # diameter = module * number of teeth
@uwezi
uwezi / 20250213_movealong.py
Last active February 13, 2025 19:16
[Three functions and some dots] Showing the plotting of functions and MoveAlongPath. #manim #animation #movealongpath #functions
# reaction to https://www.reddit.com/r/manim/comments/1iois3s/is_manim_worth_learning_for_math_visualization_or/
from manim import *
class justforfun(Scene):
def construct(self):
ax1 = Axes(
x_range = [-3,3,1],
y_range = [-1.5,+1.5,1],
x_length = 10,
y_length = 2,
@uwezi
uwezi / 20250210_superbarchart.py
Last active February 11, 2025 12:29
[SuperBarChart] A stacked barchart object using Pandas dataframes. #manim #barchart #pandas #dataframe
# https://discord.com/channels/581738731934056449/1338585711648968775/1338585711648968775
from manim import *
from pandas import DataFrame
class SuperBarChart(VGroup):
def __init__(self,
x_length,
y_range,
y_length,
dataframe,
@uwezi
uwezi / 20250123_openglcylinder.py
Last active January 23, 2025 19:40
[openglCylinder] A cylinder with arbitrary orientation for the opengl renderer. #manim #3D #cylinder #opengl
# https://discord.com/channels/581738731934056449/1332024484496150589/1332024484496150589
from manim import *
from manim.opengl import *
config.renderer="opengl"
config.write_to_movie=True
class openglCylinder(OpenGLSurface):
def __init__(self, start=ORIGIN, end=LEFT, radius=0.05, color=WHITE, **kwargs):
start = np.array(start)
@uwezi
uwezi / 20250123_openglsphere.py
Last active January 23, 2025 19:41
[openglSphere] A sphere for the opengl renderer. #manim #3D #sphere #opengl
# https://discord.com/channels/581738731934056449/1332024484496150589/1332024484496150589
from manim import *
from manim.opengl import *
config.renderer="opengl"
config.write_to_movie=True
class openglSphere(OpenGLSurface):
def __init__(self, radius=1, **kwargs):
def uvfunc(u,v):
return radius * np.array([np.cos(v)*np.cos(u),np.cos(v)*np.sin(u),np.sin(v)])
@uwezi
uwezi / 20241218_theodorus.py
Last active January 18, 2025 23:30
[Theodorus spiral] A geometric construction. #manim #geometry
from manim import *
# https://discord.com/channels/581738731934056449/1318716633912573953/1318882699775311962
class TheodorusSpiralDebug(Scene):
def construct(self):
# Initialize variables
origin_dot = Dot(point=ORIGIN)
last_line = Line(start=ORIGIN, end=RIGHT/2)
last_point = RIGHT/2
# Add starting dot and first line segment
@uwezi
uwezi / 20241229_brace3d.py
Created December 30, 2024 08:20
[Brace3D II] A flexible brace object for 3D. #manim #3D #brace
from manim import *
class Brace3D(Brace):
def __init__(self, line, rotation=0, **kwargs):
flatline = Line(ORIGIN, line.get_length()*RIGHT)
super().__init__(flatline, direction=np.array([0., -1., 0.]), **kwargs)
dline = line.get_end()-line.get_start()
self.rotate(angle=rotation, about_point=flatline.get_start(),axis=RIGHT)
self.rotate(-np.asin(dline[2]/np.linalg.norm(dline)), about_point=flatline.get_start(), axis=UP)
self.rotate(np.atan2(dline[1],dline[0]), about_point=flatline.get_start(), axis=OUT)
@uwezi
uwezi / 20241202_itheta.py
Last active March 31, 2025 12:14
[Rationale] Visualization of e^(iθ)+e^(n iθ). #manim #animation #complex #math
# https://discord.com/channels/581738731934056449/585955412436713495/1312571596287774781
# https://youtube.com/shorts/dzjnM2EDDpE?si=_M8UHJR_ku6y2qIx
from manim import *
config.frame_rate=60
class compass2(Scene):
def construct(self):
l = 2
n = np.sqrt(2) # speed multiplier on second arm
θ = ValueTracker(0)
def Zfunc(x):