本文整理汇总了Python中animation.Animation.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Animation.__init__方法的具体用法?Python Animation.__init__怎么用?Python Animation.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类animation.Animation
的用法示例。
在下文中一共展示了Animation.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, mobject1, mobject2,
run_time = DEFAULT_TRANSFORM_RUN_TIME,
interpolation_function = straight_path,
black_out_extra_points = False,
*args, **kwargs):
self.interpolation_function = interpolation_function
count1, count2 = mobject1.get_num_points(), mobject2.get_num_points()
if count2 == 0:
mobject2 = Point((SPACE_WIDTH, SPACE_HEIGHT, 0))
count2 = mobject2.get_num_points()
Mobject.align_data(mobject1, mobject2)
Animation.__init__(self, mobject1, run_time = run_time, *args, **kwargs)
self.ending_mobject = mobject2
self.mobject.SHOULD_BUFF_POINTS = \
mobject1.SHOULD_BUFF_POINTS and mobject2.SHOULD_BUFF_POINTS
self.reference_mobjects.append(mobject2)
self.name += "To" + str(mobject2)
if black_out_extra_points and count2 < count1:
#Ensure redundant pixels fade to black
indices = np.arange(
0, count1-1, float(count1) / count2
).astype('int')
temp = np.zeros(mobject2.points.shape)
temp[indices] = mobject2.rgbs[indices]
mobject2.rgbs = temp
self.non_redundant_m2_indices = indices
示例2: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, AnimationClass, mobjects, **kwargs):
centers = [mob.get_center() for mob in mobjects]
kwargs["mobject"] = Mobject().add_points(centers)
self.centers_container = AnimationClass(**kwargs)
kwargs.pop("mobject")
Animation.__init__(self, Mobject(*mobjects), **kwargs)
self.name = str(self) + AnimationClass.__name__
示例3: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, value_function, **kwargs):
"""
Value function should return a real value
depending on the state of the surrounding scene
"""
digest_config(self, kwargs, locals())
self.update_mobject()
Animation.__init__(self, self.mobject, **kwargs)
示例4: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, mobject, **kwargs):
self.intermediate = Mobject(color = self.color)
self.intermediate.add_points([
point + (x, y, 0)
for point in self.mobject.points
for x in [-1, 1]
for y in [-1, 1]
])
Animation.__init__(self, mobject, **kwargs)
示例5: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, homotopy, mobject, **kwargs):
"""
Homotopy a function from (x, y, z, t) to (x', y', z')
"""
def function_at_time_t(t):
return lambda p : homotopy(p[0], p[1], p[2], t)
self.function_at_time_t = function_at_time_t
digest_config(self, kwargs)
Animation.__init__(self, mobject, **kwargs)
示例6: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, matrix, mobject, **kwargs):
matrix = np.array(matrix)
if matrix.shape == (2, 2):
self.matrix = np.identity(3)
self.matrix[:2, :2] = matrix
elif matrix.shape == (3, 3):
self.matrix = matrix
else:
raise "Matrix has bad dimensions"
Animation.__init__(self, mobject, **kwargs)
示例7: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, mobject, target_mobject, **kwargs):
#Copy target_mobject so as to not mess with caller
self.original_target_mobject = target_mobject
target_mobject = target_mobject.copy()
digest_config(self, kwargs, locals())
mobject.align_data(target_mobject)
self.init_path_func()
Animation.__init__(self, mobject, **kwargs)
self.name += "To" + str(target_mobject)
示例8: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, mobject, ending_mobject, **kwargs):
mobject, ending_mobject = map(instantiate, [mobject, ending_mobject])
digest_config(self, kwargs, locals())
count1, count2 = mobject.get_num_points(), ending_mobject.get_num_points()
if count2 == 0:
ending_mobject.add_points([SPACE_WIDTH*RIGHT+SPACE_HEIGHT*UP])
count2 = ending_mobject.get_num_points()
Mobject.align_data(mobject, ending_mobject)
if self.should_black_out_extra_points and count2 < count1:
self.black_out_extra_points(count1, count2)
Animation.__init__(self, mobject, **kwargs)
self.name += "To" + str(ending_mobject)
self.mobject.point_thickness = ending_mobject.point_thickness
示例9: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, word, **kwargs):
self.path = Cycloid(end_theta = np.pi)
word_mob = TextMobject(list(word))
end_word = word_mob.copy()
end_word.shift(-end_word.get_bottom())
end_word.shift(self.path.get_corner(DOWN+RIGHT))
end_word.shift(3*RIGHT)
self.end_letters = end_word.split()
for letter in word_mob.split():
letter.center()
letter.angle = 0
unit_interval = np.arange(0, 1, 1./len(word))
self.start_times = 0.5*(1-(unit_interval))
Animation.__init__(self, word_mob, **kwargs)
示例10: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, body, underwear, hair=None, duration=sf.seconds(1)):
Animation.__init__(self, body.size(), duration)
self._body = body
self._underwear = underwear
self._hair = hair
self._mantle = None
self._shoes = None
self._legging = None
self._hauberk = None
self._armor = None
self._weapon = None
self._shield = None
示例11: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, mobject, color = "white", slow_factor = 0.01,
run_time = 0.1, alpha_func = None,
*args, **kwargs):
Animation.__init__(self, mobject, run_time = run_time,
alpha_func = alpha_func,
*args, **kwargs)
self.intermediate = Mobject(color = color)
self.intermediate.add_points([
point + (x, y, 0)
for point in self.mobject.points
for x in [-1, 1]
for y in [-1, 1]
])
self.reference_mobjects.append(self.intermediate)
self.slow_factor = slow_factor
示例12: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, clock, **kwargs):
digest_config(self, kwargs)
assert(isinstance(clock, Clock))
rot_kwargs = {
"axis" : OUT,
"about_point" : clock.get_center()
}
hour_radians = -self.hours_passed*2*np.pi/12
self.hour_rotation = Rotating(
clock.hour_hand,
radians = hour_radians,
**rot_kwargs
)
self.minute_rotation = Rotating(
clock.minute_hand,
radians = 12*hour_radians,
**rot_kwargs
)
Animation.__init__(self, clock, **kwargs)
示例13: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, mobject, ending_mobject, **kwargs):
mobject = instantiate(mobject)
#Copy ending_mobject so as to not mess with caller
ending_mobject = instantiate(ending_mobject).copy()
digest_config(self, kwargs, locals())
count1, count2 = mobject.get_num_points(), ending_mobject.get_num_points()
if count2 == 0:
ending_mobject.add_points(
[mobject.get_center()],
color = BLACK
)
count2 = ending_mobject.get_num_points()
Mobject.align_data(mobject, ending_mobject)
if self.should_black_out_extra_points and count2 < count1:
self.black_out_extra_points(count1, count2)
Animation.__init__(self, mobject, **kwargs)
self.name += "To" + str(ending_mobject)
self.mobject.point_thickness = ending_mobject.point_thickness
示例14: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, AnimationClass, mobject, arg_creator = None, **kwargs):
digest_config(self, kwargs)
for key in "rate_func", "run_time", "lag_ratio":
if key in kwargs:
kwargs.pop(key)
if arg_creator is None:
arg_creator = lambda mobject : (mobject,)
self.subanimations = [
AnimationClass(
*arg_creator(submob),
run_time = self.run_time,
rate_func = squish_rate_func(
self.rate_func, beta, beta + self.lag_ratio
),
**kwargs
)
for submob, beta in zip(
mobject,
np.linspace(0, 1-self.lag_ratio, len(mobject))
)
]
Animation.__init__(self, mobject, **kwargs)
示例15: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
def __init__(self, tex_list, **kwargs):
mobject = TexMobject(self.curr_tex).shift(start_center)
Animation.__init__(self, mobject, **kwargs)