首先定义了三个坐标轴:
axes1, axes2, axes3 = all_axes = VGroup(*( Axes((-3, 3), (-1, 1), height=2.0, width=FRAME_WIDTH * 0.5 - 1) for x in range(3) ))
我发现 3b1b 特别喜欢这样定义一组 mobject:
seq1_tex, seq2_tex, sum_seq, prod_seq, conv_seq = seqs = VGroup( OldTex(f"a = {list(seq1)}", **kw), OldTex(f"b = {list(seq2)}", **kw), OldTex(f"a + b = {list(seq1 + seq2)}", **kw), OldTex(Rf"a \cdot b = {list(seq1 * seq2)}", **kw), OldTex(Rf"a * b = {list(np.convolve(seq1, seq2))}", **kw), )
left_op_labels = VGroup(*map(Text, ["Addition", "Multiplication", "Convolution"]))
all_boxes = VGroup(*(SurroundingRectangle(m[2:]) for m in seqs[:3]))
以下是多组数据的简便方法:
for left_op_label, seq, graph_label in zip(left_op_labels, seqs[2:], graph_labels[2:]):
self.play( *map(Write, box_arrows), FadeIn(boxes), *( Transform( box.copy().set_stroke(width=0, opacity=0), mystery_box.copy(), path_arc=-PI / 3, remover=True ) for box in boxes ) )
随后使用滞后出现的方法添加了图像
标签:seq,OldTex,list,kw,convolutions,seq2,seq1 From: https://www.cnblogs.com/daxiangcai/p/17033829.html