Saltar a contenido

Trapeze area calculation

Manim animation

animation

GeoGebra construction

Code (manim)

Text Only
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
from manim import *

class trapecio(MovingCameraScene):

  def construct(self):
      position_list = [
          [0, 0, 0],  # middle right
          [1, 4, 0],  # bottom right
          [5, 4, 0],  # bottom left
          [6, 0, 0],  # top left
      ]
      position_list_triangle = [
          [1, 4, 0],  # C'
          [5.5, 2, 0],  # bottom left
          [5, 4, 0],  # top left
      ]
      position_list_trapecio_inferior = [
          [0, 0, 0],  # middle right
          [1, 4, 0],  # bottom right
          [5.5, 2, 0],  # bottom left
          [6, 0, 0],  # top left
      ]
      position_list_triangle2 = [
          [0, 0, 0],  # middle right
          [1, 4, 0],  # bottom right
          [10, 0, 0],  # bottom left
      ]

      # creacióm de objetos
      self.camera.frame.save_state()

      trapecio = Polygon(*position_list, color=BLUE)
      triangle = Polygon(*position_list_triangle, color=GREEN)
      trapecio_inferior = Polygon(*position_list_trapecio_inferior, color=BLUE)
      triangle2 = Polygon(*position_list_triangle2, color=WHITE)


      self.play(self.camera.frame.animate.scale(1.2).move_to(trapecio))


      text1 = Text('base menor').scale(1)
      text1.move_to((3, 5, 0));

      text2 = Text('base mayor').scale(1)
      text2.move_to((3, -0.7, 0));

      text3= Text('base menor').scale(1)
      text3.move_to((8, -0.7, 0));

      text4=Text('altura').scale(1)
      text4.move_to((-1, 2, 0))

      formula= Tex(r"$\text{Area}=\frac{(\text{base menor} + \text{base mayor})\cdot \text{altura}}{2}$", font_size=80)
      formula.move_to((3, 5, 0))

      altura=Line([1,0,0],[1, 4, 0], color=WHITE);
      altura.set_fill(WHITE, opacity=1);
      altura.set_stroke(color=WHITE, opacity=1, width=5);
      base_menor=Line([1,4,0],[5, 4, 0], color=RED);
      base_menor.set_stroke(color='#FC6255', opacity=1, width=10);
      base_mayor=Line([0,0,0],[6, 0, 0], color=YELLOW);
      base_mayor.set_stroke(color=YELLOW, opacity=1, width=10);
      final_base_menor=Line([2,0,0],[6, 0, 0], color=RED);
      final_base_menor.set_stroke(color=RED, opacity=1, width=7);


      l1 = Line([1,4,0],[5, 4, 0]);

      #dar color y opacidad a los elementos
      trapecio.set_fill(BLUE, opacity=0.2)  # set the color and transparency
      triangle.set_fill(BLUE, opacity=0.8)
      triangle.set_stroke(BLUE, width=0.2)
      trapecio_inferior.set_fill(BLUE, opacity=0.4)
      triangle2.set_fill(LIGHT_GREY, opacity=0.3)
      triangle2.set_stroke(color=LIGHT_GREY, opacity=1, width=0)


      #self.camera.frame_height=trapecio.height*1.4;
      #self.camera.frame_widh=trapecio.height*1.4;
      #self.camera.frame_center=[trapecio.width-4,trapecio.height-2, 0.];

      #self.play(Create(l1))

      numberplane = NumberPlane(
          x_range=(0, 30, 1),
          y_range=(0, 20, 1),

      )
      #aparición de los elementos
      self.play(Create(numberplane))
      self.play(DrawBorderThenFill(trapecio))
      self.play(GrowFromEdge(base_menor, LEFT))
      self.play(Create(text1))
      self.play(GrowFromEdge(base_mayor, LEFT))
      self.play(Create(text2))
      self.play(Create(altura));
      self.play(Create(text4))
      self.play(Create(triangle))

      #self.play(Create(trapecio_inferior))
      #self.camera.frame.save_state()
      self.play(Create(trapecio_inferior))

      self.wait(1)
      self.play(FadeTransform(base_menor, final_base_menor, stretch=True));
      self.play(
          Rotate(
              final_base_menor,
              angle=-PI,
              about_point=[6,0,0],
              rate_func=linear,
          )
      )

      self.wait(1)
      self.play(
          Rotate(
              triangle,
              angle=-PI,
              about_point=(5.5, 2, 0),
              rate_func=linear,
              )
          )

      #self.play(FadeTransform(text1, text3, stretch=True));
      self.play(text1.animate.shift((6, -5.6, 0)));

      self.play(Create(triangle2))
      self.play(Create(formula))

      #self.play(Restore(self.camera.frame))
      self.wait(4)