Add scale_factor parameter to BulletedList.fade_all_but

This commit is contained in:
Grant Sanderson 2025-03-19 16:48:37 -05:00
parent ac3c5b8380
commit bcfd48d951

View file

@ -36,9 +36,12 @@ class BulletedList(VGroup):
self.arrange(DOWN, buff=buff, aligned_edge=aligned_edge)
def fade_all_but(self, index: int, opacity: float = 0.25) -> None:
def fade_all_but(self, index: int, opacity: float = 0.25, scale_factor=0.7) -> None:
max_dot_height = max([item[0].get_height() for item in self.submobjects])
for i, part in enumerate(self.submobjects):
trg_dot_height = (1.0 if i == index else scale_factor) * max_dot_height
part.set_fill(opacity=(1.0 if i == index else opacity))
part.scale(trg_dot_height / part[0].get_height(), about_edge=LEFT)
class TexTextFromPresetString(TexText):