Skip to content

Commit

Permalink
changed camera angle
Browse files Browse the repository at this point in the history
  • Loading branch information
martawleklinska committed Jun 27, 2024
1 parent 6af1037 commit 86a52c7
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions zkmarek/video/slides/short1/short.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
VGroup,
FadeTransform,
MoveAlongPath,
ChangeSpeed,
)

import numpy as np
Expand Down Expand Up @@ -155,20 +156,15 @@ def animate_in(self, scene):
chaotic_points.append([x, y, z])
chaotic_path.set_points_as_corners(chaotic_points)

def custom_rate_func(t):
if t < 0.2:
return t * 0.5
elif t < 0.4:
return 0.1 + (t - 0.2) * 1.2
elif t < 0.6:
return 0.6 + (t - 0.4) * 0.8
elif t < 0.8:
return 0.7 + (t - 0.6) * 0.5
else:
return 1.0 - (t - 0.8) * 0.05
speeds = [1, 0.8, 0.7, 0.5, 0.8, 0.6, 0.3, 0.25, 0.1, 0.11, 0.05]

def speed_func(t):
return speeds[int(t * (len(speeds) - 1))]

scene.play(
MoveAlongPath(dot, chaotic_path, run_time=5, rate_func=custom_rate_func)
ChangeSpeed(
MoveAlongPath(dot, chaotic_path, run_time=5), speed_func=speed_func
)
)

dot1 = Text("?", font_size=35, font=PRIMARY_FONT, color=PRIMARY_COLOR)
Expand Down Expand Up @@ -212,7 +208,9 @@ def custom_rate_func(t):
).next_to(dot, RIGHT)
label.rotate(
scene.camera.get_phi() + 60 * DEGREES, axis=[1, 0, 0]
).rotate(scene.camera.get_phi(), axis=[0, 0, 1])
).rotate(scene.camera.get_phi(), axis=[0, 0, 1]).rotate(
angle=180 * DEGREES, axis=[1, 0, 0]
)
scene.add(dot, label)

self.new_subsection(scene, "south pole", "data/sound/short1/slide2-3.mp3")
Expand Down

0 comments on commit 86a52c7

Please sign in to comment.