3D Sine‑to‑Cosine Transformation

Loading...

Loading video...

Pro
0:00 / 0:00

Animation Specification: 3D Sine‑to‑Cosine Transformation (Defaults)

1. Overview

Create a Manim animation that displays a sine wave plotted in a 3‑D coordinate system and smoothly morphs it into a cosine wave. All parameters will use sensible defaults.

2. Mathematical Elements

  • Domain: x[0,2π]x \in [0, 2\pi]
  • Initial Curve: y=sin(x)y = \sin(x) (plotted on the xyxy-plane, with z=0z = 0)
  • Final Curve: y=cos(x)y = \cos(x) (same plane)
  • Interpolation: For the morph, use a parameter t[0,1]t \in [0,1] and define the intermediate curve as:
    yt=(1t)sin(x)+tcos(x)y_t = (1-t)\sin(x) + t\cos(x)
    This will be animated by Manim’s Transform.

3. Visual Elements

  • Axes: 3‑D axes (ThreeDAxes) with range:
    • xx: [0.5,2π+0.5][-0.5, 2\pi + 0.5]
    • yy: [1.5,1.5][-1.5, 1.5]
    • zz: [0.5,0.5][-0.5, 0.5] (kept flat for visual balance)
  • Grid: Enabled on the xyxy-plane for reference.
  • Curves:
    • Sine curve: ParametricFunction colored BLUE, stroke width 4.
    • Cosine curve: Same style, colored RED.
  • Title: "Sine ˚\r\rightarrow Cosine Transformation" placed at the top, using Text with a semi‑transparent background.
  • Labels:
    • Axis labels: "x", "y", "z".
    • Optional small markers at the start and end points of the curves (optional, default: none).

4. Animation Timing & Transitions

Segment Duration Description
1. Intro (axes fade‑in) 1.0 s Create the axes and grid.
2. Plot sine curve 1.0 s Create the blue sine curve.
3. Pause 0.5 s Hold the sine curve.
4. Morph to cosine 2.5 s Transform the sine curve into the red cosine curve using the interpolation defined above.
5. Hold final curve 0.5 s Pause on the cosine curve.
6. Fade out 0.5 s Fade out all objects.

Total runtime ≈ 6 seconds.

5. Camera Settings

  • Perspective: Static camera positioned to view the 3‑D axes at an angle of 3030^{\circ} elevation and 4545^{\circ} azimuth (Manim default for ThreeDAxes).
  • No movement during the morph; the camera remains fixed.

6. Rendering Settings (Defaults)

  • Resolution: 1920×1080 (HD)
  • Background color: White (#FFFFFF)
  • Frame rate: 30 fps
  • Quality: high_quality (Manim default)

7. Implementation Sketch (Manim Community Edition)

from manim import *

class SineToCosine3D(ThreeDScene):
    def construct(self):
        # Axes
        axes = ThreeDAxes(
            x_range=[0, 2*PI, PI/2],
            y_range=[-1.5, 1.5, 0.5],
            z_range=[-0.5, 0.5, 0.5],
            axis_config={"include_tip": True},
        )
        axes.add_coordinate_labels()
        self.set_camera_orientation(phi=30 * DEGREES, theta=45 * DEGREES)
        self.play(Create(axes), run_time=1)

        # Sine curve
        sine = ParametricFunction(
            lambda t: axes.c2p(t, np.sin(t), 0),
            t_range=[0, 2*PI],
            color=BLUE,
            stroke_width=4,
        )
        self.play(Create(sine), run_time=1)
        self.wait(0.5)

        # Cosine curve (target)
        cosine = ParametricFunction(
            lambda t: axes.c2p(t, np.cos(t), 0),
            t_range=[0, 2*PI],
            color=RED,
            stroke_width=4,
        )

        # Morph
        self.play(Transform(sine, cosine), run_time=2.5)
        self.wait(0.5)

        # Title
        title = Text("Sine → Cosine Transformation", font_size=36).to_edge(UP)
        self.add(title)

        # Fade out
        self.play(FadeOut(VGroup(axes, sine, title)), run_time=0.5)

Note: This specification follows the user’s instruction to use the defaults. If any parameter should be changed (e.g., longer domain, camera motion, different colors), please let me know.

Created By

Kang Liang (tiga)Kang Liang (tiga)

Description

A short Manim animation shows a sine curve plotted on a 3‑D coordinate system that smoothly morphs into a cosine curve. The scene includes labeled three‑dimensional axes, a grid on the xy‑plane, and a title. The transformation uses linear interpolation between sin x and cos x, demonstrating the continuous shift from one wave to the other over a six‑second runtime.

Created At

Dec 31, 2025, 12:50 PM

Tags

trigonometry3d-visualization

Status

Completed
AI Model
openai/gpt-oss-120b