from manim import *
import numpy as np
from numpy import array
run_time = 1
data = [[1, 2], [3, 4]]
def dot(pos, **kwargs):
    return Dot(pos, **kwargs)
class ManualX2Plus5xPlus6(Scene):
    def construct(self):
        x = 2  # 让 x 取某个具体值来画图
        # 手动指定四块的宽高
        # 大矩形宽 (x+3)，高 (x+2)
        # 四块：x*x, 3*x, 2*x, 2*3
        sq_x2 = Rectangle(width=x, height=x, color=BLUE, fill_opacity=0.4)
        rec_3x = Rectangle(width=3, height=x, color=RED, fill_opacity=0.4)
        rec_2x = Rectangle(width=x, height=2, color=RED, fill_opacity=0.4)
        rec_6 = Rectangle(width=3, height=2, color=GREEN, fill_opacity=0.4)
        # 手动拼：左下角 sq_x2，右边 rec_3x，上边 rec_2x，右上 rec_6
        sq_x2.shift(LEFT * (3 / 2) + DOWN * (2 / 2))
        rec_3x.next_to(sq_x2, RIGHT, buff=0)
        rec_2x.next_to(sq_x2, UP, buff=0)
        rec_6.next_to(rec_3x, UP, buff=0)
        self.play(Create(sq_x2), Create(rec_3x), Create(rec_2x), Create(rec_6))
        self.wait(1)
        self.wait(3.60)