An animated, fancy bulleted list inspired by youtube user Bog in https://youtu.be/8WkcLwXCFJQ?t=1m38s and discussed in https://discord.com/channels/581738731934056449/1375396076231594045/1375396076231594045
Last active
May 24, 2025 20:13
-
-
Save uwezi/b4a3aa5310ff88167998709289137286 to your computer and use it in GitHub Desktop.
[fancy bulleted list] A fancy bulleted list in Manim. #manim #animate #tex
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/1375396076231594045/1375396076231594045 | |
class FancyBulletlist(VGroup): | |
def __init__(self, bulletobject=None, items=[], **kwargs): | |
super().__init__(**kwargs) | |
if bulletobject == None: | |
bulletobject = Dot() | |
self.items = items | |
self.bulletobject = bulletobject | |
itemstex = Tex( | |
*[item+r"\\" for item in items], | |
tex_environment="flushleft" | |
) | |
items = [ | |
VGroup( | |
bulletobject.copy().next_to(line,LEFT), | |
line, | |
) | |
for line in itemstex | |
] | |
self.items = items | |
self.add(*items) | |
def FancyAnimation(self, item=0, bulletAnimation=SpinInFromNothing, textAnimation=Write, lag_ratio = 0): | |
return LaggedStart( | |
bulletAnimation(self.items[item][0]), | |
textAnimation(self.items[item][1]), | |
lag_ratio=lag_ratio, | |
) | |
class testFancyBulletlist(Scene): | |
def construct(self): | |
bullet = VGroup( | |
Dot(radius=0.05, color=RED), | |
RoundedRectangle(width=0.3,height=0.3,corner_radius=0.05, color=RED).rotate(45*DEGREES) | |
) | |
bpoints = FancyBulletlist( | |
bulletobject=bullet, | |
items=["First line", "Second line", "Third line"] | |
) | |
for i in range(len(bpoints)): | |
self.play(bpoints.FancyAnimation(item=i)) | |
self.wait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment