Manim's method 21

Overview

I checked manim's method. I tried using Zoomed Scene.

Sample code

from manimlib.imports import *

class test(ZoomedScene):
	CONFIG = {
		"zoom_factor": 0.3,
		"zoomed_display_height": 1,
		"zoomed_display_width": 6,
		"image_frame_stroke_width": 20,
		"zoomed_camera_config": {
			"default_frame_stroke_width": 3,
		},
	}
	def construct(self):
		dot = Dot().shift(UL * 2)
		image = ImageMobject(np.uint8([[0, 100, 30, 200], [255, 0, 5, 33]]))
		image.set_height(7)
		frame_text = TextMobject("Frame", color = PURPLE).scale(1.4)
		zoomed_camera_text = TextMobject("Zoomed camera", color = RED).scale(1.4)
		self.add(image, dot)
		zoomed_camera = self.zoomed_camera
		zoomed_display = self.zoomed_display
		frame = zoomed_camera.frame
		zoomed_display_frame = zoomed_display.display_frame
		frame.move_to(dot)
		frame.set_color(PURPLE)
		zoomed_display_frame.set_color(RED)
		zoomed_display.shift(DOWN)
		zd_rect = BackgroundRectangle(zoomed_display, fill_opacity = 0, buff = MED_SMALL_BUFF)
		self.add_foreground_mobject(zd_rect)
		unfold_camera = UpdateFromFunc(zd_rect, lambda rect: rect.replace(zoomed_display))
		frame_text.next_to(frame, DOWN)
		self.play(ShowCreation(frame), FadeInFrom(frame_text, direction = DOWN))
		self.activate_zooming()
		self.play(self.get_zoomed_display_pop_out_animation(), unfold_camera)
		zoomed_camera_text.next_to(zoomed_display_frame, DOWN)
		self.play(FadeInFrom(zoomed_camera_text, direction = DOWN))
		scale_factor = [0.5, 1.5, 0]
		self.play(frame.scale, scale_factor, zoomed_display.scale, scale_factor, FadeOut(zoomed_camera_text), FadeOut(frame_text))
		self.wait()
		self.play(ScaleInPlace(zoomed_display, 2))
		self.wait()
		self.play(frame.shift, 2.5 * DOWN)
		self.wait()
		self.play(self.get_zoomed_display_pop_out_animation(), unfold_camera, rate_func = lambda t: smooth(1 - t))
		self.play(Uncreate(zoomed_display_frame), FadeOut(frame))
		self.wait()


Generated video

https://www.youtube.com/watch?v=GetSZncd4lY

that's all.

Recommended Posts

Manim's method 7
Manim's method 13
Manim's method 2
Manim's method 18
Manim's method 17
Manim's method 5
Manim's method 15
Manim's method 16
Manim's method 20
Manim's method 10
Manim's method 9
Manim's method 6
Manim's method 21
Manim's method 4
Manim's method 8
Manim's method 14
Manim's method 22
Manim's method 19
Manim's method 12
manim's manners
Binary method
Special method
Special method
Understand k-means method
Dictionary items method
[PyTorch] Installation method
N cross method
Regression analysis method
Gradient method implementation 1
Python-peewee connection method
Class method static method
youtube-dl update method
Monte Carlo method
Mode-Matching Method Simulation_Python
Johnson method (python)
[Python] Semi-Lagrange method