上传文件至 /
数学动画们
This commit is contained in:
29
camera.py
Normal file
29
camera.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from manim import *
|
||||
|
||||
class MoveCameraToCorner(Scene):
|
||||
def construct(self):
|
||||
# 创建坐标轴
|
||||
axes = Axes(
|
||||
x_range=[0, 10, 1],
|
||||
y_range=[0, 10, 1],
|
||||
x_length=6,
|
||||
y_length=6,
|
||||
axis_config={"include_numbers": True},
|
||||
)
|
||||
self.add(axes)
|
||||
|
||||
# 等待一会儿观察默认位置
|
||||
self.wait(1)
|
||||
|
||||
# 将相机移到让原点在左下角的位置,并缩放
|
||||
self.camera.frame.save_state() # 保存初始状态(可选)
|
||||
self.camera.frame.move_to(axes.c2p(5, 5)) # 把坐标系中心移到画面中心
|
||||
self.camera.frame.shift(LEFT * 5.5 + DOWN * 3.2) # 向左下移动
|
||||
self.camera.frame.scale(0.5) # 缩小画面,相当于放大坐标轴
|
||||
|
||||
self.wait(1) # 等待动画前静止
|
||||
|
||||
# 动画执行移动和缩放
|
||||
self.play(self.camera.frame.animate.move_to(axes.c2p(5, 5)).shift(LEFT * 5.5 + DOWN * 3.2).scale(0.5), run_time=3)
|
||||
|
||||
self.wait(2)
|
||||
Reference in New Issue
Block a user