|
| 1 | +import sys |
| 2 | +sys.path.insert(0, '..') |
| 3 | + |
1 | 4 | from manim import * |
2 | | -import os |
| 5 | +from scene_utils import create_sparse_matrix |
| 6 | + |
3 | 7 |
|
4 | 8 | class Thumb(Scene): |
5 | 9 | def construct(self): |
6 | 10 | title = Tex("The Illustrated GraphBLAS").scale(1.5).to_edge(UP) |
7 | | - bullet_points = BulletedList( |
8 | | - "Selection and Application", |
9 | | - "Illustrate choosing elements with Selection criteria.", |
10 | | - "Illustrate Apply with unary ops.", |
11 | | - font_size=36 |
12 | | - ) |
13 | | - bullet_points.next_to(title, DOWN, buff=0.5) |
| 11 | + |
| 12 | + subtitle = Text("Element-wise Operations", font_size=36, color=YELLOW) |
| 13 | + subtitle.next_to(title, DOWN, buff=0.5) |
| 14 | + |
| 15 | + # Two sparse matrices combined element-wise |
| 16 | + A_data = [[0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1], [0, 0, 0, 0]] |
| 17 | + B_data = [[0, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1], [1, 0, 0, 0]] |
| 18 | + C_data = [[0, 1, 0, 0], [0, 0, 2, 0], [0, 0, 0, 2], [1, 0, 0, 0]] |
| 19 | + |
| 20 | + A_mat = create_sparse_matrix(A_data, scale=0.45) |
| 21 | + oplus = MathTex(r"\oplus").scale(1.2) |
| 22 | + B_mat = create_sparse_matrix(B_data, scale=0.45) |
| 23 | + equals_sym = MathTex("=").scale(1.2) |
| 24 | + C_mat = create_sparse_matrix(C_data, scale=0.45) |
| 25 | + |
| 26 | + equation = VGroup(A_mat, oplus, B_mat, equals_sym, C_mat).arrange(RIGHT, buff=0.3) |
| 27 | + equation.move_to(ORIGIN) |
| 28 | + |
| 29 | + # Colored labels positioned after arrange |
| 30 | + A_label = MathTex("A", color=BLUE).next_to(A_mat, DOWN, buff=0.2) |
| 31 | + B_label = MathTex("B", color=GREEN).next_to(B_mat, DOWN, buff=0.2) |
| 32 | + C_label = MathTex("C").next_to(C_mat, DOWN, buff=0.2) |
| 33 | + labels = VGroup(A_label, B_label, C_label) |
| 34 | + |
| 35 | + concept = Text("Combining and Transforming Graphs", font_size=28, color=GREEN) |
| 36 | + concept.next_to(equation, DOWN, buff=0.8) |
| 37 | + |
| 38 | + footer = Text("The GraphBLAS Forum").scale(0.75).to_edge(DOWN) |
14 | 39 |
|
15 | 40 | self.play(Write(title)) |
16 | | - self.play(FadeIn(bullet_points, shift=UP, lag_ratio=0.1)) |
17 | | - footer = Text( |
18 | | - "The GraphBLAS Forum" |
19 | | - ).scale(0.75).to_edge(DOWN) |
| 41 | + self.play(Write(subtitle)) |
| 42 | + self.play(Write(equation), Write(labels)) |
| 43 | + self.play(Write(concept)) |
20 | 44 | self.play(Write(footer)) |
21 | 45 | self.wait(1) |
0 commit comments