Last active
June 13, 2025 22:19
-
-
Save uwezi/ee618994fd37e09900b14a7492bed03f to your computer and use it in GitHub Desktop.
[GlowDot] A glowing Dot() object. #manim #dot #glow #neon
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
# 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) | |
class testGlow(Scene): | |
def construct(self): | |
dots = VGroup( | |
GlowDot( | |
point=[np.random.uniform(-6,6),np.random.uniform(-3.5,3.5),0], | |
r_min=np.random.normal(0.05,0.18), | |
r_max=np.random.normal(0.2,0.3), | |
color=np.random.choice([RED,GREEN,BLUE,PURE_RED,PURE_GREEN,PURE_BLUE,YELLOW,ORANGE,TEAL,PURPLE]), | |
) | |
for _ in range(100) | |
) | |
self.play(Create(dots)) | |
self.wait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment