Rectangle Utilities

Example: MyWrapWithRectanlgeExampleScene

../_images/MyWrapWithRectanlgeExampleScene-1.png

Code: MyWrapWithRectanlgeExampleScene

import manim as m

from manta.color_theme.catppucin.catppuccin_mocha import CatppuccinMochaTheme
from manta.components.neural_networks_utils import NeuralNetworkUtils
from manta.components.uml_utils import UmlUtils
from manta.slide_templates.minimal.minimal_slide_template import MinimalSlideTemplate


# https://www.asciiart.eu/video-games/pacman
ascii_art = r"""
================================================.
     .-.   .-.     .--.                         |
    | OO| | OO|   / _.-' .-.   .-.  .-.   .''.  |
    |   | |   |   \  '-. '-'   '-'  '-'   '..'  |
    '^^^' '^^^'    '--'                         |
===============.  .-.  .================.  .-.  |
               | |   | |                |  '-'  |
               | |   | |                |       |
               | ':-:' |                |  .-.  |
               |  '-'  |                |  '-'  |
==============='       '================'       |
"""

class MyWrapWithRectanlgeExampleScene(UmlUtils, NeuralNetworkUtils, MinimalSlideTemplate):
    subtitle_color = CatppuccinMochaTheme.yellow
    title_seperator_color = CatppuccinMochaTheme.magenta

    def construct(self):

        text = self.term_text("This is a "
                              "multiline text")

        wrapped_text = self.wrap_with_rectangle(text)

        text_circuit = self.term_paragraph(ascii_art)

        wrapped_ascii_art = self.wrap_with_rectangle(text_circuit)


        wrapper_group = m.VGroup(wrapped_text, wrapped_ascii_art).arrange(direction=m.RIGHT)
        wrapper_group.move_to(m.ORIGIN)

        self.play(
            self.set_title_row(
                title="RectangleUtils",
                seperator=": ",
                subtitle="wrap_with_rectangle",
            ),
            m.FadeIn(
                wrapper_group
            )
        )



if __name__ == '__main__':
    MyWrapWithRectanlgeExampleScene.render_video_medium()

Example: MyWrapWithRectanlgeAndIconExampleScene

../_images/MyWrapWithRectanlgeAndIconExampleScene-1.png

Code: MyWrapWithRectanlgeAndIconExampleScene

import manim as m
from pyrr.rectangle import width

from manta.color_theme.catppucin.catppuccin_mocha import CatppuccinMochaTheme
from manta.components.neural_networks_utils import NeuralNetworkUtils
from manta.components.uml_utils import UmlUtils
from manta.slide_templates.minimal.minimal_slide_template import MinimalSlideTemplate


# https://www.asciiart.eu/video-games/pacman
ascii_art = r"""
================================================.
     .-.   .-.     .--.                         |
    | OO| | OO|   / _.-' .-.   .-.  .-.   .''.  |
    |   | |   |   \  '-. '-'   '-'  '-'   '..'  |
    '^^^' '^^^'    '--'                         |
===============.  .-.  .================.  .-.  |
               | |   | |                |  '-'  |
               | |   | |                |       |
               | ':-:' |                |  .-.  |
               |  '-'  |                |  '-'  |
==============='       '================'       |
"""

class MyWrapWithRectanlgeAndIconExampleScene(UmlUtils, NeuralNetworkUtils, MinimalSlideTemplate):
    subtitle_color = CatppuccinMochaTheme.yellow
    title_seperator_color = CatppuccinMochaTheme.magenta

    def construct(self):
        text = self.term_text("This is a \n multiline text")

        wrapped_text = self.wrap_with_icon_and_rectangle(
            text,
            icon='users',
            # if with is not set, the width will be calculated automatically
            # same for height
            width=6,
            height=2
        )

        text_ascii_art = self.term_paragraph(ascii_art).scale_to_fit_width(3)

        wrapped_ascii_art = self.wrap_with_icon_and_rectangle(text_ascii_art, direction='up', icon='ghost')


        wrapper_group = m.VGroup(wrapped_text, wrapped_ascii_art).arrange(direction=m.RIGHT)


        self.play(
            self.set_title_row(
                title="RectangleUtils",
                seperator=": ",
                subtitle="wrap_with_icon_and_rectangle",
            ),
            m.FadeIn(
                wrapper_group
            )
        )



if __name__ == '__main__':
    MyWrapWithRectanlgeAndIconExampleScene.render_video_medium()

Example: MyIconTextBoxExampleScene

../_images/MyIconTextBoxExampleScene-1.png

Code: MyIconTextBoxExampleScene

import manim as m
from pyrr.rectangle import width, height

from manta.color_theme.catppucin.catppuccin_mocha import CatppuccinMochaTheme
from manta.components.neural_networks_utils import NeuralNetworkUtils
from manta.components.uml_utils import UmlUtils
from manta.slide_templates.minimal.minimal_slide_template import MinimalSlideTemplate


# https://www.asciiart.eu/video-games/pacman
ascii_art = r"""
================================================.
     .-.   .-.     .--.                         |
    | OO| | OO|   / _.-' .-.   .-.  .-.   .''.  |
    |   | |   |   \  '-. '-'   '-'  '-'   '..'  |
    '^^^' '^^^'    '--'                         |
===============.  .-.  .================.  .-.  |
               | |   | |                |  '-'  |
               | |   | |                |       |
               | ':-:' |                |  .-.  |
               |  '-'  |                |  '-'  |
==============='       '================'       |
"""

class MyIconTextBoxExampleScene(UmlUtils, NeuralNetworkUtils, MinimalSlideTemplate):
    subtitle_color = CatppuccinMochaTheme.yellow
    title_seperator_color = CatppuccinMochaTheme.magenta

    def construct(self):

        icon_text_box1 = self.icon_textbox("Im an introvert.", icon='user')
        icon_text_box2 = self.icon_textbox(
            "Im an extrovert. \n I love to talk to people.",
            icon='users',
            icon_color=self.magenta,
            # if with is not set, the width will be calculated automatically
            # same for height
            width=5,
            height=2.5,
            t2c={"extrovert": self.blue},
            # this is an alternative to t2c
            # just type the words you want to colorize
            # and specify the color
            t2c_strs=["talk", "people"],
            t2c_color=self.green,
        )

        wrapper_group = m.VGroup(icon_text_box1, icon_text_box2).arrange(direction=m.DOWN)

        self.play(
            self.set_title_row(
                title="RectangleUtils",
                seperator=": ",
                subtitle="icon_textbox",
            ),
            m.FadeIn(
                wrapper_group
            )
        )



if __name__ == '__main__':
    MyIconTextBoxExampleScene.render_video_medium()

Example: MyIconBulletpointTextBoxExampleScene

../_images/MyIconBulletpointTextBoxExampleScene-1.png

Code: MyIconBulletpointTextBoxExampleScene

import manim as m
from pyrr.rectangle import width, height

from manta.color_theme.catppucin.catppuccin_mocha import CatppuccinMochaTheme
from manta.components.neural_networks_utils import NeuralNetworkUtils
from manta.components.uml_utils import UmlUtils
from manta.slide_templates.minimal.minimal_slide_template import MinimalSlideTemplate


class MyIconBulletpointTextBoxExampleScene(UmlUtils, NeuralNetworkUtils, MinimalSlideTemplate):
    subtitle_color = CatppuccinMochaTheme.yellow
    title_seperator_color = CatppuccinMochaTheme.magenta

    def construct(self):

        icon_text_box1 = self.icon_bulletpoints_textbox(
            ["Im an introvert.", "It's exhausting for me to talk to people."],
            icon='user'
        )
        icon_text_box2 = self.icon_bulletpoints_textbox(
            ["Im an extrovert.", " I love to talk to people."],
            icon='users',
            bullet_icon='users',
            icon_color=self.magenta,
            # if with is not set, the width will be calculated automatically
            # same for height
            width=10,
            height=2.5,
            t2c={"extrovert": self.blue},
            # this is an alternative to t2c
            # just type the words you want to colorize
            # and specify the color
            t2c_strs=["talk", "people"],
            t2c_color=self.green,
        )

        wrapper_group = m.VGroup(icon_text_box1, icon_text_box2).arrange(direction=m.DOWN)

        self.play(
            self.set_title_row(
                title="RectangleUtils",
                seperator=": ",
                subtitle="icon_bulletpoints_textbox",
            ),
            m.FadeIn(
                wrapper_group
            )
        )



if __name__ == '__main__':
    MyIconBulletpointTextBoxExampleScene.render_video_medium()

Example: MyTitledIconBulletpointTextBoxExampleScene

../_images/MyTitledIconBulletpointTextBoxExampleScene-1.png

Code: MyTitledIconBulletpointTextBoxExampleScene

import manim as m
from pyrr.rectangle import width, height

from manta.color_theme.catppucin.catppuccin_mocha import CatppuccinMochaTheme
from manta.components.neural_networks_utils import NeuralNetworkUtils
from manta.components.uml_utils import UmlUtils
from manta.slide_templates.minimal.minimal_slide_template import MinimalSlideTemplate


class MyTitledIconBulletpointTextBoxExampleScene(UmlUtils, NeuralNetworkUtils, MinimalSlideTemplate):
    subtitle_color = CatppuccinMochaTheme.yellow
    title_seperator_color = CatppuccinMochaTheme.magenta

    def construct(self):

        icon_text_box1 = self.icon_title_bulletpoints_textbox(
            [
                ("Extrovert", ["Im an extrovert.", "I love to talk to people."]),
            ],
            icon='users',
        )
        icon_text_box2 = self.icon_title_bulletpoints_textbox(
            [
                ("Introvert", ["Im an introvert.", "It's exhausting for me to talk to people."]),
                ("Misanthrope", ["I dislike the presence of other people.", "Please leave me alone."]),
            ],
            icon='user',
            bullet_icon='user',
            icon_color=self.magenta,
            # if with is not set, the width will be calculated automatically
            # same for height
            width=10,
            height=4.0,
            t2c={
                "extrovert": self.blue,
                "Please leave me alone": self.red,
            },
            # this is an alternative to t2c
            # just type the words you want to colorize
            # and specify the color
            t2c_strs=["talk", "people"],
            t2c_color=self.green,
        )

        wrapper_group = m.VGroup(icon_text_box1, icon_text_box2).arrange(direction=m.DOWN)

        self.play(
            self.set_title_row(
                title="RectangleUtils",
                seperator=": ",
                subtitle="icon_title_bulletpoints_textbox",
            ),
            m.FadeIn(
                wrapper_group
            )
        )



if __name__ == '__main__':
    MyTitledIconBulletpointTextBoxExampleScene.render_video_medium()