Support Fluxion Engine
If you find this project useful, please consider supporting its development.
Support ProjectLearn how to create and animate text in your Fluxion scenes.
from fluxion import *
class BasicText(Scene):
def construct(self):
text = Text("Hello, Fluxion!")
self.play(Write(text))
self.wait()text = Text("Custom Font", font="Arial", font_size=48)text = Text("Colored Text", color=BLUE)
text.set_color(RED) # Change colortext = Text("Gradient Text")
text.set_color_by_gradient(BLUE, GREEN)Use MathTex for mathematical expressions:
formula = MathTex(r"E = mc^2")
self.play(Write(formula))equation = MathTex(
r"\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}"
)title = Text("Title").to_edge(UP)
subtitle = Text("Subtitle").next_to(title, DOWN)# Write text character by character
self.play(Write(text))
# Fade in
self.play(FadeIn(text))
# Add text instantly
self.add(text)
# Transform between text
self.play(Transform(text1, text2))# Left aligned
text.align_to(ORIGIN, LEFT)
# Center aligned (default)
text.move_to(ORIGIN)
# Right aligned
text.align_to(ORIGIN, RIGHT)text = Text("""
Line 1
Line 2
Line 3
""")text = Text("Highlighted")
background = SurroundingRectangle(text, color=YELLOW, fill_opacity=0.3)
self.add(background, text)If you find this project useful, please consider supporting its development.
Support Project