本文整理汇总了Python中mobject.vectorized_mobject.VMobject.submobject_gradient_highlight方法的典型用法代码示例。如果您正苦于以下问题:Python VMobject.submobject_gradient_highlight方法的具体用法?Python VMobject.submobject_gradient_highlight怎么用?Python VMobject.submobject_gradient_highlight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mobject.vectorized_mobject.VMobject
的用法示例。
在下文中一共展示了VMobject.submobject_gradient_highlight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: construct
# 需要导入模块: from mobject.vectorized_mobject import VMobject [as 别名]
# 或者: from mobject.vectorized_mobject.VMobject import submobject_gradient_highlight [as 别名]
def construct(self):
line = NumberLine()
self.add(line, *self.get_mobjects())
offset = LEFT+DOWN
vect = 2*RIGHT+UP
dots = VMobject(*[
Dot(offset + a*vect, radius = 0.075)
for a in np.linspace(-2, 3, 18)
])
dots.submobject_gradient_highlight(YELLOW_B, YELLOW_C)
func = self.get_matrix_transformation(self.t_matrix)
new_dots = VMobject(*[
Dot(
func(dot.get_center()),
color = dot.get_color(),
radius = dot.radius
)
for dot in dots
])
words = TextMobject(
"Line of dots remains evenly spaced"
)
words.next_to(line, UP, buff = MED_SMALL_BUFF)
self.play(Write(dots))
self.apply_transposed_matrix(
self.t_matrix,
added_anims = [Transform(dots, new_dots)]
)
self.play(Write(words))
self.dither()
示例2: construct
# 需要导入模块: from mobject.vectorized_mobject import VMobject [as 别名]
# 或者: from mobject.vectorized_mobject.VMobject import submobject_gradient_highlight [as 别名]
def construct(self):
word = TextMobject("``Parallelepiped''")
word.scale(2)
pp_part1 = VMobject(*word.split()[:len(word.split())/2])
pp_part2 = VMobject(*word.split()[len(word.split())/2:])
pp_part1.submobject_gradient_highlight(X_COLOR, Y_COLOR)
pp_part2.submobject_gradient_highlight(Y_COLOR, Z_COLOR)
self.play(Write(word))
self.dither(2)
示例3: construct
# 需要导入模块: from mobject.vectorized_mobject import VMobject [as 别名]
# 或者: from mobject.vectorized_mobject.VMobject import submobject_gradient_highlight [as 别名]
def construct(self):
self.lock_in_faded_grid()
vectors = VMobject(*[
Vector([x, y])
for x in np.arange(-int(SPACE_WIDTH)+0.5, int(SPACE_WIDTH)+0.5)
for y in np.arange(-int(SPACE_HEIGHT)+0.5, int(SPACE_HEIGHT)+0.5)
])
vectors.submobject_gradient_highlight(PINK, BLUE_E)
words = TextMobject("Span")
words.scale(3)
words.to_edge(UP)
words.add_background_rectangle()
self.add(vectors, words)