đź’»

AI prompt

Cupboard in a Room Animation Prompt (Manim Community v0.19.0)

Task: Generate Python code using Manim Community v0.19.0 for the following animation. The animation should flow continuously, and at each step only display objects relevant to the concept being explained (hide or remove others).

General Requirements:

Steps:

  1. Draw the Room: Create two horizontal lines to represent the floor and ceiling, 2.2 m apart. Position the floor line near the bottom of the frame and the ceiling line near the top to use most of the view height. Label the vertical distance between them as 2.2 m.
  1. Option 1 – Build Lying and Rotate:
    • Place a rectangle on the floor (lying flat) to represent the cupboard. It should be 2.0 m long horizontally and 0.0 m tall initially.
    • Animate this rectangle’s height growing from 0 to 0.8 m while keeping its base on the floor.
    • Once that growth is complete, rotate the rectangle 90° upward around its bottom-left corner so it stands upright. The final upright rectangle should be 2.0 m tall and 0.8 m wide.
  1. Option 2 – Build Upright Directly:
    • Create another rectangle with its base on the floor. Set its width to 0.8 m and initial height to 0.0 m.
    • Animate its height increasing from 0 up to 2.0 m so that it ends up standing upright 2.0 m tall.
  1. Illustrate the Diagonal Problem:
    • Create a rectangle 2.05 m long (horizontal) and 1.0 m tall (vertical) lying on the floor.
    • Animate it rotating upward; it should intersect the ceiling line (simulate hitting the ceiling).
    • Then rotate it back down to the floor and remove it.
    • Next, create a new rectangle on the floor with width 1.0 m and initial height 0. Animate its height growing up to 2.05 m so it is built upright (final height 2.05 m, width 1.0 m).
  1. Indicate the Unknown Diagonal:
    • On the original 2.0 m by 0.8 m cupboard (lying on the floor), draw a diagonal line from the bottom-left corner to the top-right corner.
    • Label this diagonal with a question mark (”?”) to indicate its length is unknown.
  1. Show the Pythagorean Theorem:
    • Draw a right triangle separate from the cupboard.
    • Label its legs a and b (corresponding to the cupboard’s 2.0 m height and 0.8 m width) and label the hypotenuse c.
    • Next to the triangle, display the formula a^2 + b^2 = c^2 to illustrate how to calculate the hypotenuse.
  1. Calculate and Compare Diagonal:
    • Label the cupboard’s sides a = 2.0\text{ m} and b = 0.8\text{ m}. Compute the diagonal c = \sqrt{a^2 + b^2} and display the result (e.g., c \approx 2.15\text{ m}).
    • Compare this c to the room height 2.2 m. Display text indicating that since 2.15\text{ m} < 2.2\text{ m}, the cupboard fits when rotated. Note that if c were greater than 2.2 m, it would not fit under the ceiling, so one would have to build it upright instead.