Skip to content

Quickstart

Before You Begin

Before proceeding, install fluxion and make sure it is running properly by following the steps in the Installation guide.

Virtual Environment

If you installed fluxion using uv, make sure the virtual environment is activated, or prefix commands with uv run.

Overview

This quickstart guide will lead you through creating a sample project using Fluxion: an animation engine for precise programmatic animations.

Starting a New Project

Create a new project folder:

bash
fluxion init project my-project --default

Animating a Circle

Open main.py:

python
from fluxion import *

class CreateCircle(Scene):
    def construct(self):
        circle = Circle()
        circle.set_fill(PINK, opacity=0.5)
        self.play(Create(circle))

Run:

bash
fluxion -pql main.py CreateCircle

CreateCircle Animation

TIP

All animations must reside within the construct method of a Scene class.

Transforming Shapes

python
class SquareToCircle(Scene):
    def construct(self):
        circle = Circle()
        circle.set_fill(PINK, opacity=0.5)
        square = Square()
        square.rotate(PI / 4)
        
        self.play(Create(square))
        self.play(Transform(square, circle))
        self.play(FadeOut(square))

Square to Circle Transformation

Positioning Mobjects

python
class SquareAndCircle(Scene):
    def construct(self):
        circle = Circle()
        circle.set_fill(PINK, opacity=0.5)
        
        square = Square()
        square.set_fill(BLUE, opacity=0.5)
        
        square.next_to(circle, RIGHT, buff=0.5)
        self.play(Create(circle), Create(square))

Positioning with next_to

Using .animate Syntax

python
class AnimatedSquareToCircle(Scene):
    def construct(self):
        circle = Circle()
        square = Square()
        
        self.play(Create(square))
        self.play(square.animate.rotate(PI / 4))
        self.play(Transform(square, circle))
        self.play(square.animate.set_fill(PINK, opacity=0.5))

Animated Transformations

You're Done! 🎉

Continue to the Building Blocks tutorial to learn more, or explore the Examples gallery!

Released under the MIT License.