summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/space-curves/file4_cone.py
blob: e6ae1c622722b38248277801b84834e672ba8db1 (plain)
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
from manimlib.imports import *

class cone(ThreeDScene):
    def construct(self):
        axes = ThreeDAxes()
        eqn = TextMobject(r'$z^{2} = x^{2} + y^{2}$')

        conecurve = ParametricFunction(
            lambda t: np.array([
                t*np.cos(TAU*t),
                t*np.sin(TAU*t),
                t
            ]), t_min = -2.6, t_max = 2.6
        ).scale(0.85)

        conesurface = ParametricSurface(
            lambda u,v: np.array([
                3*np.sin(u)*np.cos(TAU*v),
                3*np.sin(u)*np.sin(TAU*v),
                2.7*u
            ]), u_min = -1
        ).scale(0.85)

        self.play(FadeIn(eqn))
        self.wait(2)
        self.play(FadeOut(eqn))
        self.set_camera_orientation(phi = 75*DEGREES, theta=50*DEGREES)
        self.play(FadeIn(axes), ShowCreation(conecurve, run_time = 3))
        self.play(FadeOut(conecurve), FadeIn(conesurface))
        self.begin_ambient_camera_rotation(rate=0.03)
        self.wait(2)
        self.play(FadeOut(axes), FadeOut(conesurface))
        self.wait(2)