Skip to content

Instantly share code, notes, and snippets.

@jaddoescad
Created March 10, 2019 16:58
Show Gist options
  • Save jaddoescad/8b605df33910f3ec19e76032c1caa31b to your computer and use it in GitHub Desktop.
Save jaddoescad/8b605df33910f3ec19e76032c1caa31b to your computer and use it in GitHub Desktop.
Highlight Text
from big_ol_pile_of_manim_imports import *
class RotateAndHighlight(Scene):
#Rotation of text and highlighting with surrounding geometries
def construct(self):
square=Square(side_length=5,fill_color=YELLOW, fill_opacity=1)
label=TextMobject("Text at an angle")
label.bg=BackgroundRectangle(label,fill_opacity=1)
label_group=VGroup(label.bg,label) #Order matters
label_group.rotate(TAU/8)
label2=TextMobject("Boxed text",color=BLACK)
label2.bg=SurroundingRectangle(label2,color=BLUE,fill_color=RED, fill_opacity=.5)
label2_group=VGroup(label2,label2.bg)
label2_group.next_to(label_group,DOWN)
label3=TextMobject("Rainbow")
label3.scale(2)
label3.set_color_by_gradient(RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE)
label3.to_edge(DOWN)
self.add(square)
self.play(FadeIn(label_group))
self.play(FadeIn(label2_group))
self.play(FadeIn(label3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment