from manim import *
import numpy as np
def make_earth(r):
    g = VGroup(Circle(radius=r, color=BLUE_D, fill_color=BLUE_C,
                      fill_opacity=1, stroke_width=2))
    for dx, dy, w, h in ((-0.35, 0.3, 0.75, 0.5), (0.38, -0.22, 0.6, 0.42),
                         (-0.1, -0.55, 0.42, 0.26)):
        e = Ellipse(width=w * r, height=h * r, color=GREEN_B,
                    fill_opacity=1, stroke_width=0)
        e.shift(r * np.array([dx, dy, 0]))
        g.add(e)
    return g
def make_sun(r):
    g = VGroup(Circle(radius=r, color=YELLOW, fill_opacity=1, stroke_width=0))
    for i in range(12):
        a = i * TAU / 12
        p1 = r * 1.25 * np.array([np.cos(a), np.sin(a), 0])
        p2 = r * 1.7 * np.array([np.cos(a), np.sin(a), 0])
        g.add(Line(p1, p2, color=YELLOW, stroke_width=6))
    return g
class Demo(Scene):
    def construct(self):
        sun = make_sun(1.0).shift(DOWN * 1.0)
        earth = make_earth(0.42).shift(UP * 1.6)
        self.play(FadeIn(sun), FadeIn(earth), run_time=0.6)
        self.play(Rotate(earth, about_point=sun.get_center(), angle=TAU,
                         axis=IN, run_time=4.0, rate_func=linear))
        self.wait(1.0)
