Sine Curve Morphs into Cosine – Phase Shift Demo
Loading...
Loading video...
Pro
0:00 / 0:00
Animation Specification for SinToCos
1. Overview
- Purpose: Visualize the relationship between the sine and cosine functions by first drawing the sine curve on a set of axes, then smoothly transforming it into the cosine curve.
- Target Audience: Students learning trigonometric functions and their phase shift relationship.
2. Mathematical Elements
- Axes:
- x‑range:
- y‑range:
- x‑ticks: at multiples of (i.e., ) with labels using LaTeX (e.g., "$0$, , , , $2\pi$").
- y‑ticks: at with labels "", "$0$", "$1$".
- Functions:
- Sine: plotted in BLUE.
- Cosine: plotted in RED.
3. Visual Elements
| Element | Description | Color / Style |
|---|---|---|
| Axes | Standard Cartesian axes with arrowheads, tick marks, and labels as described above. | White (default) |
| Sine curve | Smooth curve representing . | BLUE (hex #1B9AF7) |
| Cosine curve | Smooth curve representing . | RED (hex #FF4C4C) |
| Background | Black or dark gray to make the colored curves stand out. | #0B0B0B (default Manim background) |
4. Animation Sequence & Timing
| Step | Action | Duration | Easing / Transition |
|---|---|---|---|
| 1 | Create Axes – draw the axes with a Create animation. | 2 seconds | Linear (default) |
| 2 | Create Sine Curve – draw the sine curve using Create. | 2 seconds | Linear |
| 3 | Transform to Cosine – morph the sine curve into the cosine curve using Transform. | 3 seconds | Smooth (default) |
| 4 | Pause – hold the final frame so viewers can observe the cosine curve. | 1.5 seconds | – |
5. Camera Settings
- Default 2‑D camera (no zoom or rotation). The camera frame should be sized to comfortably include the entire axes range with a small margin (e.g.,
camera.frame_width = 8,camera.frame_height = 6). - No additional camera movements are required.
6. Additional Details & Assumptions
- Line thickness for both curves:
stroke_width=4(default Manim line thickness). - Axes labels: optional
xandylabels can be added ("x"and"y") positioned near the ends of the axes. - Background opacity: keep the default opaque background for clarity.
- Code Structure: The animation follows the provided class structure, with the
constructmethod containing the sequence ofself.playcalls. - Libraries: Assumes
manimversion 0.17+ andnumpyimported asnp.
7. Full Pseudocode (for reference)
class SinToCos(Scene):
def construct(self):
axes = Axes(
x_range=[0, 2*PI, PI/2],
y_range=[-1.5, 1.5, 0.5],
x_axis_config={"numbers_to_include": [0, PI/2, PI, 3*PI/2, 2*PI]},
y_axis_config={"numbers_to_include": [-1, 0, 1]},
tips=False,
)
sin_curve = axes.plot(lambda x: np.sin(x), color=BLUE, stroke_width=4)
cos_curve = axes.plot(lambda x: np.cos(x), color=RED, stroke_width=4)
self.play(Create(axes), run_time=2)
self.play(Create(sin_curve), run_time=2)
self.play(Transform(sin_curve, cos_curve), run_time=3)
self.wait(1.5)
This specification provides all necessary details for recreating the animation, including mathematical context, visual styling, timing, and camera setup.
Created By
Description
The animation draws the axes from 0 to 2π, creates the blue sine curve, then smoothly transforms it into the red cosine curve, illustrating the π/2 phase shift between sin x and cos x. A pause at the end lets viewers observe the final cosine shape.
Created At
Dec 31, 2025, 04:58 PM
Tags
trigonometrysinecosinephase-shift
Status
Completed