Skip to content

Commit

Permalink
Show both lines and sidebar for EC addition
Browse files Browse the repository at this point in the history
  • Loading branch information
marekkirejczyk committed Jun 20, 2023
1 parent 81271df commit 7760e34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion zkmarek/video/slides/ec/addition.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ def animate_in(self, scene):
scene.add(self.chart)
AnimateAddition.play(scene, self.chart, 5, 1, 10, 0)
self.new_subsection(scene, "Overflow the field")
AnimateAddition.play(scene, self.chart, 5, 1, 9, 1)
anim = AnimateAddition.play(scene, self.chart, 5, 1, 9, 1, animate_out=False)
self.new_subsection(scene, "Sidebar")
self.chart.animate_align_left(scene)
self.sidebar.animate_in(scene, self)
anim.animate_out(scene)

def animate_out(self, scene):
self.sidebar.animate_out(scene)
Expand Down
11 changes: 10 additions & 1 deletion zkmarek/video/slides/ec/animate_addition.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,16 @@ def animate_in(self, scene: Scene, c0: ECAffine, c1: ECAffine):
self.line2 = Line(p[2], p[3], color=DARK_GREY)
scene.play(GrowFromPoint(self.line2, point=p[2], run_time=5))
scene.play(FadeIn(self.labels[3]))
self.chart.add(*self.lines)
self.chart.add(self.line2)
self.chart.add(*self.labels)

def animate_out(self, scene):
scene.play(FadeOut(*self.labels))
scene.play(FadeOut(self.line2), FadeOut(*self.lines))
self.chart.remove(*self.lines)
self.chart.remove(self.line2)
self.chart.remove(*self.labels)

@staticmethod
def play(
Expand All @@ -59,9 +65,12 @@ def play(
a1_odd: int,
a2_x: int,
a2_odd: int,
animate_out: bool = True,
):
a1 = chart.find_affine_by_x(a1_x, a1_odd)
a2 = chart.find_affine_by_x(a2_x, a2_odd)
anim = AnimateAddition(chart)
anim.animate_in(scene, a1, a2)
anim.animate_out(scene)
if animate_out:
anim.animate_out(scene)
return anim

0 comments on commit 7760e34

Please sign in to comment.