Refactor generate_logo

This commit is contained in:
Grant Sanderson
2015-10-29 17:00:46 -07:00
parent e4b61dc5df
commit f581446c4e
9 changed files with 42 additions and 23 deletions

View File

@ -23,10 +23,14 @@ class LogoGeneration(Scene):
"sphere_blue" : DARK_BLUE,
"sphere_brown" : LIGHT_BROWN,
"interpolation_factor" : 0.3,
"frame_duration" : 0.01,
"frame_duration" : 0.03,
"run_time" : 3,
}
def construct(self):
digest_config(self, {})
## Usually shouldn't need this...
self.frame_duration = self.DEFAULT_CONFIG["frame_duration"]
##
digest_config(self, {})
circle = Circle(
density = self.circle_density,
@ -59,11 +63,11 @@ class LogoGeneration(Scene):
self.play(Transform(
circle, iris,
run_time = DEFAULT_ANIMATION_RUN_TIME
run_time = self.run_time
))
self.frames = drag_pixels(self.frames)
self.set_frame_as_background()
self.save_image()
self.save_image(IMAGE_DIR)
self.show_frame()
self.add(name)
self.dither()
print "Dragging pixels..."

View File

@ -118,7 +118,7 @@ def random_color():
################################################
def straight_path(start_points, end_points, alpha):
return (1-alpha)*start_points + alpha*end_points
return interpolate(start_points, end_points, alpha)
def path_along_arc(arc_angle):
"""

View File

@ -7,9 +7,9 @@ from helpers import *
class TexMobject(Mobject):
DEFAULT_CONFIG = {
"template_tex_file" : TEMPLATE_TEX_FILE,
"color" : WHITE,
"point_thickness" : 1,
"should_center" : False,
"color" : WHITE,
"point_thickness" : 1,
"should_center" : False,
}
def __init__(self, expression, **kwargs):
if "size" not in kwargs:

View File

@ -241,6 +241,7 @@ class Scene(object):
@staticmethod
def args_to_string(*args):
return ""
@staticmethod
def string_to_args(string):
raise Exception("string_to_args Not Implemented!")

View File

@ -1,19 +1,26 @@
\documentclass[12pt]{beamer}
\usepackage[english]{babel}
\usepackage{mathtools}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{setspace}
\usepackage{tipa}
\usepackage{relsize}
\mode<presentation>
{
\usetheme{default} % or try Darmstadt, Madrid, Warsaw, ...
\usecolortheme{default} % or try albatross, beaver, crane, ...
\usefonttheme[onlymath]{serif} % or try serif, structurebold, ...
\usefonttheme{serif} % or try serif, structurebold, ...
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
}
\begin{document}
\centering
\begin{frame}
\centering
SizeHere
\begin{align*}
YourTextHere

View File

@ -1,20 +1,27 @@
\documentclass[12pt]{beamer}
\usepackage[english]{babel}
\usepackage{mathtools}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{setspace}
\usepackage{tipa}
\usepackage{relsize}
\mode<presentation>
{
\usetheme{default} % or try Darmstadt, Madrid, Warsaw, ...
\usecolortheme{default} % or try albatross, beaver, crane, ...
\usefonttheme[onlymath]{serif} % or try serif, structurebold, ...
\usefonttheme{serif} % or try serif, structurebold, ...
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
}
\begin{document}
\begin{frame}
\centering
SizeHere
YourTextHere
\end{frame}
\end{document}

View File

@ -225,7 +225,7 @@ class Bubble(Mobject):
class SpeechBubble(Bubble):
DEFAULT_CONFIG = {
"initial_width" : 4,
"initial_width" : 4,
"initial_height" : 2,
}
@ -257,9 +257,9 @@ class SpeechBubble(Bubble):
class ThoughtBubble(Bubble):
DEFAULT_CONFIG = {
"num_bulges" : 7,
"num_bulges" : 7,
"initial_inner_radius" : 1.8,
"initial_width" : 6
"initial_width" : 6,
}
def __init__(self, **kwargs):
Bubble.__init__(self, **kwargs)

View File

@ -29,10 +29,10 @@ class FunctionGraph(Mobject1D):
class ParametricFunction(Mobject):
DEFAULT_CONFIG = {
"color" : WHITE,
"dim" : 1,
"color" : WHITE,
"dim" : 1,
"expected_measure" : 10.0,
"density" : None
"density" : None
}
def __init__(self, function, **kwargs):
self.function = function

View File

@ -9,8 +9,8 @@ from helpers import *
class Stars(Mobject):
DEFAULT_CONFIG = {
"point_thickness" : 1,
"radius" : SPACE_WIDTH,
"num_points" : 1000,
"radius" : SPACE_WIDTH,
"num_points" : 1000,
}
def __init__(self, **kwargs):
digest_config(self, Stars, kwargs)