반응형
The Indicating series animation class is an animation that draws attention to an object displayed on the screen while blinking it.
Indicating related classes are as follows.
Class | Parameters | Explanation |
ShowCreationThenDestruction | mobject | Draw an object for a short time and then make it disappear |
Indicate | mobject | Make the object blink by the scale of the scale_factor and return it to the original size |
WiggleOutThenIn | mobject | The effect of shaking slightly from side to side while slightly expanding. Scale how large it is to scale_value=1.1. rotation_angle=0.01*TAU adjusts the shaking angle |
ApplyWave | mobject | Makes objects sway like waves. direction=UP to determine the direction of the wave. In the case of UP, the wave goes upward and then returns to its original position. Determine the digging with amplitude=0.2 |
CircleIndicate | mobject | Draw and erase the circle surrounding the object. The CONFIG value of the circle can be adjusted with circle_config. Since the object itself is not drawn, the object must be added on the screen in advance |
FocusOn | mobject | The large flash-shaped light quickly diminishes and converges toward the object. Specify the color of the fire light with color=GREY. Specify the transparency of the fire light with opacity=0.2. It does not draw itself, but only emphasizes existing objects |
Flash | Parameters | Draw and erase a small fire flower-shaped flash in the center of the object. Specify the length of the fire flower segment with line_length=0.2. num_lines=12 specifies the number of segments that make up the fire flower. Specify the radius of the fire flower with flash_radius=0.3, and the line thickness with line_stroke_width=3. It does not draw the center object itself, but only emphasizes the existing object. |
ShowPassingFlashAround | mobject | Animation of small segments rapidly rotating around the object's surrounding rectangle. It does not draw the object itself, but only emphasizes the existing object. |
ShowCreationThenDestructionAround | mobject | Draw a rectangle around the object as if you were drawing with a pen, and after drawing the shape of the rectangle, remove the rectangle as if you were erasing it in the direction you drew. It does not draw the object itself, but only emphasizes the existing object. |
ShowCreationThenFadeAround | mobject | Draw a rectangle around the object as you would with a pen, and after drawing the rectangle, make the rectangle disappear gradually. It does not draw the object itself, but only emphasizes the existing object. |
ShowPassingFlash | mobject | The effect that a small light sweeps through the object's outline once. It does not draw the object itself, but only emphasizes the existing object. |
AnimationOnSurroundingRectangle | mobject | Draw a rectangle around the object, and the drawn rectangle does not disappear. It does not draw the object itself, but only emphasizes the existing object. |
Animations related to 'indicating' have CONFIG values that determine the size of the indicating. For the Indicate class, you can specify the size to be emphasized, such as scale_factor=1.2.
Below is the code that shows the operation of Indicating series classes in sequence.
Unlike the sample code in the previous Creationg series animation, we added a Dot, changed the Line to an Arrow, and made it animate for each individual object, not for the entire VGroup object.
That's because we can see what happens when each object is animated: text, circles, points, and arrows.
Text class does not work for ApplyWave. So, I used TextMobject.
class IndicatingTest(Scene):
def construct(self):
self.indicating()
def indicating(self):
ani_classes = {
"ShowCreationThenDestruction": (ShowCreationThenDestruction,),
"Indicate": (Indicate, ),
"WiggleOutThenIn": (WiggleOutThenIn,),
"ApplyWave": (ApplyWave, ),
}
ani_classes_need_pre_exist={
"CircleIndicate": (CircleIndicate,),
"FocusOn": (FocusOn,),
"Flash": (Flash,),
"ShowPassingFlashAround": (ShowPassingFlashAround,),
"ShowCreationThenDestructionAround": (ShowCreationThenDestructionAround,),
"ShowCreationThenFadeAround": (ShowCreationThenFadeAround,),
"ShowPassingFlash": (ShowPassingFlash,),
"AnimationOnSurroundingRectangle": (AnimationOnSurroundingRectangle,),
}
idx = 1
for name, ani in ani_classes.items():
self.do_ani(idx, name, ani)
idx += 1
#need to existing mobject prior to play animation
for name, ani in ani_classes_need_pre_exist.items():
self.do_ani(idx, name, ani, need_prior=True)
idx += 1
def do_ani(self, idx, ani_name, ani, obj=None, need_prior=False):
def get_obj():
text = TextMobject("Hello. This is animation test")
circle1 = Circle(radius=1)
circle2 = Circle(radius=1, fill_color=YELLOW, fill_opacity=1)
circles = VGroup(circle1, circle2)
dot = Dot()
arrow = Arrow(LEFT, RIGHT, stroke_width=5).set_width(3)
dot.next_to(arrow, LEFT, buff=0.5)
dot_arrow = VGroup(dot, arrow)
text.next_to(circles, UP)
circles = VGroup(circle1, circle2)
circles.arrange(RIGHT)
dot_arrow.next_to(circles, DOWN)
return VGroup(text, circle1, circle2, dot, arrow)
if obj is None:
mobs = get_obj()
else:
mobs = obj
if need_prior:
self.add(mobs)
name_text = Text(str(idx) + ". " + ani_name, stroke_width=0, size=0.4, color=YELLOW)
name_text.to_corner(UL)
self.add(name_text)
self.wait()
for mob in mobs:
if len(ani) == 1:
self.play(ani[0](mob), run_time=1)
elif len(ani) == 2:
self.play(ani[0](mob, ani[1]), run_time=1)
elif len(ani) == 3:
self.play(ani[0](mob, ani[1], ani[2]), run_time=1)
else:
self.play(ani[0](mob, ani[1:]), run_time=1)
self.wait()
self.remove(name_text, mobs)
Next: [06-1-D] Animation : Move/Rotating series
Go To: [99] Table of Contents
반응형
'Programming > Manim Lectures' 카테고리의 다른 글
[06-1-E] Animation : Transformation series (1/3) (0) | 2020.06.09 |
---|---|
[06-1-D] Animation : Move/Rotating series (0) | 2020.06.09 |
[06-1-B] Animation : Creation series (0) | 2020.06.09 |
[06-1-A] Animation Class and Rate Function (2) | 2020.06.09 |
[06-1] Animation by Classes (0) | 2020.06.09 |