Skip to content

Square

Square Parameters#

Paremeters - as mentioned in Azarzadvillas Documentation - are:

  • Constructor : - Dot

  • side_length :

    • float (ex: 3)
    • Optional
    • Default: 2.0

Square Creation#

from manimlib import *

class SquareCreation(Scene):
    def construct(self):
        square = Square()
        self.play(ShowCreation(square), run_time=3)
        self.wait()
from manim import *

class SquareCreation(Scene):
    def construct(self):
        square = Square()
        self.play(Create(square), run_time=3)
        self.wait()

Set Stroke & Fill#

from manimlib import *

class SquareFill(Scene):
    def construct(self):
        square = Square()
        square.set_stroke(YELLOW)
        self.wait()
        self.play(ShowCreation(square), run_time=3)
        square.set_fill(GREEN, opacity=1)
        self.wait()
from manim import *

class SquareFilled(Scene):
    def construct(self):
        square = Square()
        square.set_stroke(YELLOW)
        self.wait()
        self.play(Create(square), run_time=3)
        square.set_fill(GREEN, opacity=1)
        self.wait()

Square Fade-In#

from manimlib import *

class SquareFade(Scene):
    def construct(self):
        square = Square()
        square.set_stroke(YELLOW)
        self.wait()
        self.play(ShowCreation(square), run_time=3)
        square.set_fill(GREEN, opacity=1)
        self.wait(2)
        self.play(FadeIn(square), run_time=3)
        self.wait()
from manim import *

class SquareFilled(Scene):
    def construct(self):
        square = Square()
        square.set_stroke(YELLOW)
        self.wait()
        self.play(Create(square), run_time=3)
        square.set_fill(GREEN, opacity=1)
        self.wait()
        self.play(FadeIn(square), run_time=3)
        self.wait()
Back to top