Skip to content

Commit

Permalink
added changes (with sound) to pairing slide in episode 3 - removed ex…
Browse files Browse the repository at this point in the history
…amples, added transformations
  • Loading branch information
martawleklinska committed Jul 15, 2024
1 parent babf402 commit 3da6318
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 186 deletions.
Binary file modified data/sound/episode3/slide2-1.mp3
Binary file not shown.
Binary file modified data/sound/episode3/slide2-2.mp3
Binary file not shown.
Binary file added data/sound/episode3/slide2-2_1.mp3
Binary file not shown.
Binary file modified data/sound/episode3/slide2-3.mp3
Binary file not shown.
Binary file modified data/sound/episode3/slide2-4.mp3
Binary file not shown.
Binary file modified data/sound/episode3/slide2-5.mp3
Binary file not shown.
Binary file modified data/sound/episode3/slide2-6.mp3
Binary file not shown.
Binary file removed data/sound/episode3/slide2-7.mp3
Binary file not shown.
28 changes: 14 additions & 14 deletions zkmarek/video/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,21 @@

EPISODE3 = [
# Intro(sound="data/sound/teaser2/slide0-0.mp3"),
Sponsored(),
Introduction(),
TitleSlide("Pairing", sound="data/sound/episode3/slide1-3.mp3", wait_time=3),
# Sponsored(),
# Introduction(),
# TitleSlide("Pairing", sound="data/sound/episode3/slide1-3.mp3", wait_time=3),
Pairing(),
TitleSlide("Trusted setup"),
TrustedSetup(),
Ceremony(),
CeremonyVerification(),
CeremonyVerification2(),
TitleSlide("KZG", subtitle="Kate, Zaverucha and Goldberg"),
PolynomialCommitment(),
KZG(),
Verkle(),
Subscribe("data/sound/episode1/s28.wav"),
Credits2(),
# TitleSlide("Trusted setup"),
# TrustedSetup(),
# Ceremony(),
# CeremonyVerification(),
# CeremonyVerification2(),
# TitleSlide("KZG", subtitle="Kate, Zaverucha and Goldberg"),
# PolynomialCommitment(),
# KZG(),
# Verkle(),
# Subscribe("data/sound/episode1/s28.wav"),
# Credits2(),
]

EPISODE4 = [
Expand Down
7 changes: 5 additions & 2 deletions zkmarek/video/slides/episode3/morphin_math_text.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import List

from manim import MathTex, Scene, TransformMatchingTex, Unwrite, VGroup, Write
from manim import MathTex, Scene, TransformMatchingTex, Unwrite, VGroup, Write, Indicate

from zkmarek.video.constant import SECONDARY_COLOR
from zkmarek.video.constant import SECONDARY_COLOR, PRIMARY_COLOR


class MorphinMathText(VGroup):
Expand All @@ -28,6 +28,9 @@ def animate_out(self, scene: Scene):

def animate_first(self, scene: Scene):
scene.play(Write(self.texs[0]))
scene.wait(3)
scene.play(Indicate(self.texs[0], color = PRIMARY_COLOR))
scene.wait(1)

def animate_rest(self, scene: Scene):
for i in range(0, len(self.texs) - 1):
Expand Down
212 changes: 42 additions & 170 deletions zkmarek/video/slides/episode3/pairing.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
from manim import (
DOWN,
UP,
LEFT,
RIGHT,
Brace,
FadeIn,
FadeOut,
MathTex,
Text,
Unwrite,
Write,
VGroup,
MoveToTarget,
ReplacementTransform,
Indicate,
)
from manim import DOWN, UP, Brace, FadeIn, FadeOut, MathTex, Text, Unwrite, Write, VGroup, TransformMatchingShapes, Indicate

from zkmarek.video.constant import (
PRIMARY_COLOR,
SECONDARY_COLOR,
PRIMARY_FONT,
HIGHLIGHT_COLOR,
)
from zkmarek.video.constant import PRIMARY_COLOR, SECONDARY_COLOR, PRIMARY_FONT, HIGHLIGHT_COLOR
from zkmarek.video.slides.common.slide_base import SlideBase
from zkmarek.video.slides.episode3.morphin_math_text import MorphinMathText
from zkmarek.video.mobjects.equation_box import EquationBoxWithIcons
from zkmarek.video.slides.episode3.discreete_polynomial_chart import DiscreetePolynomialChart
def poly(x):
return x * x * x - x * x * 2 + x * 3 + 4
Expand All @@ -37,7 +15,6 @@ class Pairing(SlideBase):
brace3: Brace
brace1_label: Text
brace2_label: Text
brace3_label: Text
bilinearity_label: MathTex
bilinearity: MathTex
bilinearity_morph: MorphinMathText
Expand All @@ -58,13 +35,19 @@ def construct(self):
self.brace3.shift(UP * 2.5)
self.brace1_label = Text(r"Subgroup of points on elliptic curve", font_size=30, color=PRIMARY_COLOR, font = PRIMARY_FONT)
self.brace1.put_at_tip(self.brace1_label)
self.brace2_label = Text(r"Subgroup of points on elliptic curve", font_size=30, color=PRIMARY_COLOR, font = PRIMARY_FONT)
self.brace2.put_at_tip(self.brace2_label)
self.brace3_label = Text(r"Prime field", font_size=30, color=PRIMARY_COLOR, font = PRIMARY_FONT)
self.brace3.put_at_tip(self.brace3_label)
self.chart = DiscreetePolynomialChart(41, poly).scale(0.55)
self.bilinearity_label = Text("Bilinearity", font_size=40, color=SECONDARY_COLOR, font = PRIMARY_FONT)
self.bilinearity = MathTex(r"e({{P}} + {{P'}}, Q) = {{e(P, Q)}} \cdot {{e(P', Q)}}", font_size=40, color=SECONDARY_COLOR)
self.bilinearity1 = MathTex(r"e({{P}} \oplus {{P'}}, Q)", font_size = 40, color = SECONDARY_COLOR)
self.bilinearity = MathTex(r"e(P \oplus P', Q) = e({{P}}, Q) \oplus e({{P'}}, Q)", font_size=40, color=SECONDARY_COLOR)
self.bilinearity2 = MathTex(r"e(P + P', Q) = e({{P}}, Q) \oplus e({{P'}}, Q)", font_size=40, color=SECONDARY_COLOR)
self.bilinearity3 = MathTex(r"e(P + P', Q) = e({{P}}, Q) \cdot e({{P'}}, Q)", font_size=40, color=SECONDARY_COLOR)

self.bilinearity1[1].set_color(PRIMARY_COLOR)
self.bilinearity1[3].set_color(PRIMARY_COLOR)
self.bilinearity[1].set_color(PRIMARY_COLOR)
self.bilinearity[3].set_color(PRIMARY_COLOR)
self.bilinearity_morph = MorphinMathText([
r"{{e(aP, bQ)}}",
r"{{e(aP, bQ)}} = e({{a}}P, bQ){{ }}",
Expand Down Expand Up @@ -98,166 +81,55 @@ def construct(self):
self.computability_label.next_to(self.non_degeneracy, DOWN, buff=0.6)

def animate_in(self, scene):
self.new_subsection(
scene, "what is a pairing", "data/sound/episode3/slide2-0.mp3"
)
self.new_subsection(scene, "what is a pairing", "data/sound/episode3/slide2-0.mp3")
scene.play(Write(self.definition_label))
scene.play(Write(self.definition))

scene.play(FadeIn(self.brace1))
scene.play(FadeIn(self.brace1, self.brace2))
scene.play(FadeIn(self.brace1_label))
scene.play(
FadeOut(self.brace1),
FadeOut(self.brace1_label))

scene.play(FadeIn(self.brace2))
scene.play(FadeIn(self.brace2_label))
scene.play(
FadeOut(self.brace2),
FadeOut(self.brace2_label))
scene.wait(2.4)
scene.play(FadeOut(self.brace1, self.brace2), FadeOut(self.brace1_label))

scene.play(FadeIn(self.brace3))
scene.play(FadeIn(self.brace3_label))
scene.play(
FadeOut(self.brace3),
FadeOut(self.brace3_label))
scene.wait(2.7)
scene.play(Indicate(self.definition[0], color = HIGHLIGHT_COLOR))
scene.play(FadeOut(self.brace3), FadeOut(self.brace3_label))
scene.wait(3)
scene.play(Indicate(self.definition[0], color = HIGHLIGHT_COLOR, scale_factor=2))

self.new_subsection(scene, "bilinear definition", "data/sound/episode3/slide2-1.mp3")
scene.play(Write(self.bilinearity_label))
scene.play(Write(self.bilinearity))
scene.play(Write(self.bilinearity1))
scene.wait(2)
scene.play(Indicate(self.bilinearity[1], color = PRIMARY_COLOR))
scene.play(Indicate(self.bilinearity[3], color = PRIMARY_COLOR))
scene.wait(2.5)
scene.play(Indicate(self.bilinearity[5], color = PRIMARY_COLOR))
scene.play(Indicate(self.bilinearity[7], color = PRIMARY_COLOR))
scene.play(Indicate(self.bilinearity1[1], color = PRIMARY_COLOR))
scene.play(Indicate(self.bilinearity1[3], color = PRIMARY_COLOR))
scene.wait(1)
scene.play(TransformMatchingShapes(VGroup(self.bilinearity1[1].copy(), self.bilinearity1[3].copy(), self.bilinearity1), self.bilinearity))

self.new_subsection(scene, "operations on ec and pairings", "data/sound/episode3/slide2-2.mp3")
scene.wait(3.5)
self.other_things = VGroup(self.bilinearity, self.bilinearity_label, self.definition)
self.other_things.generate_target()
self.other_things.target.shift(LEFT*4.5).scale(0.4)
scene.play(MoveToTarget(self.other_things))
self.chart.gen_points()
scene.play(FadeIn(self.chart))
self.new_subsection(
scene, "bilinearity example", "data/sound/episode3/slide2-2.mp3"
)
self.example_bilinearity(scene)
scene.play(TransformMatchingShapes(self.bilinearity, self.bilinearity2))
self.play_sound(scene, "data/sound/episode3/slide2-2_1.mp3")
scene.wait(1)
scene.play(TransformMatchingShapes(self.bilinearity2, self.bilinearity3))
scene.wait(2)

self.new_subsection(scene, "multiplying", "data/sound/episode3/slide2-4.mp3")
self.new_subsection(scene, "multiplying", "data/sound/episode3/slide2-3.mp3")
self.bilinearity_morph.animate_in(scene)
self.new_subsection(
scene, "explaining the multiplying", "data/sound/episode3/slide2-5.mp3"
)
scene.play(
self.bilinearity_morph.texs[-1].animate.next_to(
self.bilinearity_label, DOWN
), Unwrite(self.bilinearity)
)

self.new_subsection(scene, "explaining the multiplying", "data/sound/episode3/slide2-4.mp3")
scene.play(self.bilinearity_morph.texs[-1].animate.next_to(self.bilinearity, DOWN))

scene.play(Write(self.multiplying), Write(self.multiplying_brace), Write(self.multiplying_brace_label))
scene.wait(3)
scene.wait(4)
scene.play(Unwrite(self.multiplying), Unwrite(self.multiplying_brace), Unwrite(self.multiplying_brace_label))

self.new_subsection(scene, "non degeneracy", "data/sound/episode3/slide2-6.mp3")
scene.play(Indicate(self.bilinearity3, color = PRIMARY_COLOR))
scene.wait(2)
scene.play(FadeOut(self.bilinearity_morph))
self.new_subsection(scene, "non degeneracy", "data/sound/episode3/slide2-5.mp3")
scene.play(Write(self.non_degeneracy_label))
scene.play(Write(self.non_degeneracy))

self.new_subsection(scene, "computability", "data/sound/episode3/slide2-7.mp3")
self.new_subsection(scene, "computability", "data/sound/episode3/slide2-6.mp3")
scene.play(Write(self.computability_label))

def example_bilinearity(self, scene):
scene.wait(3)
scene.play(FadeOut(self.chart))
self.example_operaton = (
MathTex(r"e(x,y)=2^{xy}", color=HIGHLIGHT_COLOR)
.next_to(self.definition_label, DOWN)
)
self.x = MathTex(r"x=4", color=HIGHLIGHT_COLOR).to_edge(RIGHT+UP).shift(LEFT)
y1 = MathTex(r"y=5", color=HIGHLIGHT_COLOR).next_to(self.x, DOWN)
self.y = MathTex(r"y=2+3", color=HIGHLIGHT_COLOR).next_to(self.x, DOWN)
scene.wait(1)
scene.play(Write(self.example_operaton), run_time=0.7)
scene.wait(6)
scene.play(Write(self.x), Write(y1), run_time=0.7)
scene.wait(2.5)
scene.play(ReplacementTransform(y1, self.y))
pairing_bilin1 = EquationBoxWithIcons.create(
"⎘",
"{{e(4,2+3)}}",
SECONDARY_COLOR,
).shift(DOWN).scale(1.2)
pairing_bilin2 = EquationBoxWithIcons.create(
"⎘",
"{{e(4,2+3)}} = {{e(4, 2)\cdot e(4,3)}}",
SECONDARY_COLOR).shift(DOWN).scale(1.2)
pairing_bilin3 = EquationBoxWithIcons.create(
"⎘",
"{{e(4,2+3)}} = {{e(4, 2)\cdot e(4,3)}} = {{2^{4\cdot 2}\cdot2^{4\cdot 3}}}",
SECONDARY_COLOR,
).shift(DOWN).scale(1.2)

pairing_bilin3 = EquationBoxWithIcons.create(
"⎘",
"{{e(4,2+3)}} = {{e(4, 2)\cdot e(4,3)}} = {{2^{4\cdot 2}\cdot2^{4\cdot 3}}} = {{2^{20}}}",
SECONDARY_COLOR).scale(1.2).shift(DOWN)

pairing_bilin4 = EquationBoxWithIcons.create(
"⎘",
"{{e(4,2+3)}} = {{2^{20}}}",
SECONDARY_COLOR).shift(DOWN).scale(1.2)
scene.play(Write(pairing_bilin1), run_time=0.7)
scene.wait(0.6)
scene.play(ReplacementTransform(pairing_bilin1, pairing_bilin2), run_time=0.7)
scene.wait(0.6)
scene.play(ReplacementTransform(pairing_bilin2, pairing_bilin3), run_time=0.7)
scene.wait(0.6)
scene.play(ReplacementTransform(pairing_bilin3, pairing_bilin4), run_time=0.7)

self.new_subsection(
scene, "finishing example", "data/sound/episode3/slide2-3.mp3"
)
pairing_bilin5 = EquationBoxWithIcons.create(
"⎘",
"{{e(4,2+3)}} = {{2^{20}}}",
SECONDARY_COLOR,
"⎘",
"{{e(4,5)}}",
SECONDARY_COLOR,
).shift(DOWN).scale(1.2)
pairing_bilin6 = EquationBoxWithIcons.create(
"⎘",
"{{e(4,2+3)}} = {{2^{20}}}",
SECONDARY_COLOR,
"⎘",
"{{e(4,5)}} = {{2^{4\cdot 5}}}",
SECONDARY_COLOR,
).shift(DOWN).scale(1.2)
pairing_bilin7 = EquationBoxWithIcons.create(
"⎘",
"{{e(4,2+3)}} = {{2^{20}}}",
SECONDARY_COLOR,
"⎘",
"{{e(4,5)}} = {{2^{4\cdot 5}}} = {{2^{20}}}",
SECONDARY_COLOR,
).shift(DOWN).scale(1.2)
scene.play(ReplacementTransform(pairing_bilin4,pairing_bilin5), run_time=0.7)
scene.wait(1)
scene.play(ReplacementTransform(pairing_bilin5, pairing_bilin6), run_time=0.7)
scene.wait(1)
scene.play(ReplacementTransform(pairing_bilin6, pairing_bilin7), run_time=0.7)
scene.wait(1)

scene.play(
Unwrite(self.example_operaton),
Unwrite(self.x),
Unwrite(self.y),
FadeOut(pairing_bilin7)

)
self.other_things.generate_target()
self.other_things.target.shift(RIGHT*4.5).scale(1/0.4)
scene.play(MoveToTarget(self.other_things))




0 comments on commit 3da6318

Please sign in to comment.