starting main moser video

This commit is contained in:
Grant Sanderson
2015-04-14 17:55:25 -07:00
parent 398b92406c
commit d79db9d142
13 changed files with 225 additions and 46 deletions

View File

@ -5,6 +5,8 @@ from animation import *
from mobject import *
from constants import *
from helpers import *
from scene import *
from image_mobject import *
import itertools as it
import os
@ -14,12 +16,12 @@ import numpy as np
DARK_BLUE = "#236B8E"
DARK_BROWN = "#8B4513"
LIGHT_BROWN = "#CD853F"
LOGO_RADIUS = 1.5
if __name__ == '__main__':
size = 1.5
circle = Circle(color = 'skyblue').repeat(4).scale(size)
sphere = Sphere(density = 100, color = DARK_BLUE).scale(size)
circle = Circle(density = 100, color = 'skyblue').repeat(5).scale(LOGO_RADIUS)
sphere = Sphere(density = 100, color = DARK_BLUE).scale(LOGO_RADIUS)
sphere.rotate(-np.pi / 7, [1, 0, 0])
sphere.rotate(-np.pi / 7)
alpha = 0.3
@ -27,20 +29,21 @@ if __name__ == '__main__':
Mobject.interpolate(circle, sphere, iris, alpha)
for mob, color in [(iris, LIGHT_BROWN), (circle, DARK_BROWN)]:
mob.highlight(color, lambda (x, y, z) : x < 0 and y > 0)
mob.highlight("black", lambda point: np.linalg.norm(point) < size/2)
mob.highlight("black", lambda point: np.linalg.norm(point) < 0.55*LOGO_RADIUS)
#TODO, reimplement all of this.
name = tex_mobject("3Blue1Brown").center()
name = tex_mobject(r"\text{3Blue1Brown}").center()
name.highlight("gray")
# name.highlight(DARK_BROWN, lambda (x, y, z) : x < 0 and y > 0)
name.shift((0, -2, 0))
create_eye = Transform(
sc = Scene()
sc.animate(Transform(
circle, iris,
run_time = DEFAULT_ANIMATION_RUN_TIME,
name = "LogoGeneration"
).then(
Animation(name, dither_time = 0)
).drag_pixels()
create_eye.write_to_movie()
index = int(DEFAULT_ANIMATION_RUN_TIME / DEFAULT_ANIMATION_PAUSE_TIME)
create_eye.frames[index].save(LOGO_PATH)
run_time = DEFAULT_ANIMATION_RUN_TIME
))
sc.add(name)
sc.dither()
sc.frames = drag_pixels(sc.frames)
sc.write_to_movie("LogoGeneration", end_dither_time = 0)
# index = int(DEFAULT_ANIMATION_RUN_TIME / DEFAULT_ANIMATION_PAUSE_TIME)
# create_eye.frames[index].save(LOGO_PATH)