Skip to content

Instantly share code, notes, and snippets.

View uwezi's full-sized avatar

Uwe Zimmermann uwezi

View GitHub Profile
@uwezi
uwezi / 20250715_pango.py
Created July 15, 2025 07:37
[test fonts] Test pango fonts for compatibility with non-latin scripts. #manim #pango #text #fontlist #font
from manim import *
class testarabic(Scene):
def construct(self):
i=0
texts = VGroup()
for font in Text.font_list():
print(font)
texts += VGroup(
Text(font, font_size=18).next_to([0,3.5-0.8*i,0],LEFT,buff=0.5),
Text("جيب", font=font).next_to([0,3.5-0.8*i,0],RIGHT,buff=0)
@uwezi
uwezi / 20250712_cli.py
Created July 13, 2025 08:13
[command line arguments] How to use command line arguments inside a Manim scene. #manim #sys #commandline #tempconfig
from manim import *
import sys
class clitest(Scene):
def construct(self):
args = VGroup(
Text(arg)
for arg in self.argv
).arrange(DOWN)
self.add(args)
@uwezi
uwezi / 20250613_glowdot.py
Last active June 13, 2025 22:19
[GlowDot] A glowing Dot() object. #manim #dot #glow #neon
# after DIscord user Maxime
# https://discord.com/channels/581738731934056449/976376734935048223/1383208229760143532
class GlowDot(VMobject):
def __init__(self, point=ORIGIN, r_min=0.05, r_max=0.15, color=YELLOW, n=20, opacity_mult=1.0, **kwargs):
super().__init__(fill_color=color, fill_opacity=1, stroke_width=0, **kwargs)
for a in np.linspace(0, 1, n):
self.add(
Dot(point, radius=interpolate(r_min, r_max, a))
)
self.set_fill(color, opacity=opacity_mult / n)
@uwezi
uwezi / 20250603_decnum.py
Last active June 3, 2025 20:13
[increasing a number in steps] How to increase a DecimalNumber in discrete steps in an animation. #manim #decimalnumber #updater #valuetracker
from manim import *
# https://discord.com/channels/581738731934056449/1379443317175091252/1379443317175091252
class Test(Scene):
def construct(self):
numbers = [100]*10
numbersVG = VGroup(Text(str(n)) for n in numbers)
numbersVG.arrange(RIGHT).shift(1.3 * DOWN)
self.add(numbersVG)
@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)