algomanim 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- algomanim/__init__.py +25 -0
- algomanim/assets/__init__.py +0 -0
- algomanim/assets/svg/__init__.py +3 -0
- algomanim/assets/svg/arrows/radius_x10.svg +61 -0
- algomanim/assets/svg/arrows/radius_x12.svg +61 -0
- algomanim/assets/svg/arrows/radius_x14.svg +61 -0
- algomanim/assets/svg/arrows/radius_x16.svg +61 -0
- algomanim/assets/svg/arrows/radius_x18.svg +61 -0
- algomanim/assets/svg/arrows/radius_x20.svg +61 -0
- algomanim/assets/svg/arrows/template.svg +80 -0
- algomanim/core/__init__.py +9 -0
- algomanim/core/base.py +103 -0
- algomanim/core/linear_container.py +553 -0
- algomanim/core/rectangle_cells.py +162 -0
- algomanim/datastructures/__init__.py +9 -0
- algomanim/datastructures/array.py +332 -0
- algomanim/datastructures/linked_list.py +364 -0
- algomanim/datastructures/string.py +368 -0
- algomanim/examples/README.md +44 -0
- algomanim/examples/examples.py +1233 -0
- algomanim/examples/rend_no_poetry.sh +54 -0
- algomanim/examples/rend_poetry.sh +53 -0
- algomanim/examples/video_output/high_quality/.gitkeep +0 -0
- algomanim/examples/video_output/low_quality/.gitkeep +0 -0
- algomanim/examples/video_output/medium_quality/.gitkeep +0 -0
- algomanim/helpers/__init__.py +11 -0
- algomanim/helpers/datastructures.py +43 -0
- algomanim/ui/__init__.py +17 -0
- algomanim/ui/code_block.py +151 -0
- algomanim/ui/relative_text.py +170 -0
- algomanim/ui/titles.py +254 -0
- algomanim-0.3.0.dist-info/LICENSE +21 -0
- algomanim-0.3.0.dist-info/METADATA +55 -0
- algomanim-0.3.0.dist-info/RECORD +35 -0
- algomanim-0.3.0.dist-info/WHEEL +4 -0
algomanim/__init__.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from .core.base import AlgoManimBase
|
|
2
|
+
from .core.linear_container import LinearContainerStructure
|
|
3
|
+
from .core.rectangle_cells import RectangleCellsStructure
|
|
4
|
+
|
|
5
|
+
from .datastructures.array import Array
|
|
6
|
+
from .datastructures.string import String
|
|
7
|
+
from .datastructures.linked_list import LinkedList
|
|
8
|
+
|
|
9
|
+
from .ui.code_block import CodeBlock
|
|
10
|
+
from .ui.relative_text import RelativeText, RelativeTextValue
|
|
11
|
+
from .ui.titles import TitleText, TitleLogo
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"AlgoManimBase",
|
|
15
|
+
"LinearContainerStructure",
|
|
16
|
+
"RectangleCellsStructure",
|
|
17
|
+
"Array",
|
|
18
|
+
"String",
|
|
19
|
+
"LinkedList",
|
|
20
|
+
"CodeBlock",
|
|
21
|
+
"RelativeText",
|
|
22
|
+
"RelativeTextValue",
|
|
23
|
+
"TitleText",
|
|
24
|
+
"TitleLogo",
|
|
25
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="210mm"
|
|
6
|
+
height="297mm"
|
|
7
|
+
viewBox="0 0 210 297"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg1"
|
|
10
|
+
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
|
11
|
+
sodipodi:docname="radius_x10.svg"
|
|
12
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
13
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
16
|
+
<sodipodi:namedview
|
|
17
|
+
id="namedview1"
|
|
18
|
+
pagecolor="#ffffff"
|
|
19
|
+
bordercolor="#000000"
|
|
20
|
+
borderopacity="0.25"
|
|
21
|
+
inkscape:showpageshadow="2"
|
|
22
|
+
inkscape:pageopacity="0.0"
|
|
23
|
+
inkscape:pagecheckerboard="0"
|
|
24
|
+
inkscape:deskcolor="#d1d1d1"
|
|
25
|
+
inkscape:document-units="mm"
|
|
26
|
+
showguides="true"
|
|
27
|
+
inkscape:zoom="0.5"
|
|
28
|
+
inkscape:cx="235"
|
|
29
|
+
inkscape:cy="297"
|
|
30
|
+
inkscape:window-width="1863"
|
|
31
|
+
inkscape:window-height="1066"
|
|
32
|
+
inkscape:window-x="0"
|
|
33
|
+
inkscape:window-y="0"
|
|
34
|
+
inkscape:window-maximized="1"
|
|
35
|
+
inkscape:current-layer="layer1" />
|
|
36
|
+
<defs
|
|
37
|
+
id="defs1">
|
|
38
|
+
<inkscape:path-effect
|
|
39
|
+
effect="bspline"
|
|
40
|
+
id="path-effect3"
|
|
41
|
+
is_visible="true"
|
|
42
|
+
lpeversion="1.3"
|
|
43
|
+
weight="33.333333"
|
|
44
|
+
steps="2"
|
|
45
|
+
helper_size="0"
|
|
46
|
+
apply_no_weight="true"
|
|
47
|
+
apply_with_weight="true"
|
|
48
|
+
only_selected="false"
|
|
49
|
+
uniform="false" />
|
|
50
|
+
</defs>
|
|
51
|
+
<g
|
|
52
|
+
inkscape:label="svg"
|
|
53
|
+
inkscape:groupmode="layer"
|
|
54
|
+
id="layer1"
|
|
55
|
+
style="display:inline">
|
|
56
|
+
<path
|
|
57
|
+
id="path8"
|
|
58
|
+
style="fill:#000000;fill-rule:evenodd;stroke-width:0"
|
|
59
|
+
d="m 121.26185,33.208309 38.65707,15.462624 -38.65707,15.46262 a 28,28 0 0 0 4.36976,-11.46287 H 119.91878 70.206048 57.1624 a 97.32504,97.32504 0 0 0 0.08217,-3.99872 97.32504,97.32504 0 0 0 -0.08217,-4.001305 h 13.043648 49.712732 5.71283 a 28,28 0 0 0 -4.36976,-11.462349 z" />
|
|
60
|
+
</g>
|
|
61
|
+
</svg>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="210mm"
|
|
6
|
+
height="297mm"
|
|
7
|
+
viewBox="0 0 210 297"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg1"
|
|
10
|
+
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
|
11
|
+
sodipodi:docname="radius_x12.svg"
|
|
12
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
13
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
16
|
+
<sodipodi:namedview
|
|
17
|
+
id="namedview1"
|
|
18
|
+
pagecolor="#ffffff"
|
|
19
|
+
bordercolor="#000000"
|
|
20
|
+
borderopacity="0.25"
|
|
21
|
+
inkscape:showpageshadow="2"
|
|
22
|
+
inkscape:pageopacity="0.0"
|
|
23
|
+
inkscape:pagecheckerboard="0"
|
|
24
|
+
inkscape:deskcolor="#d1d1d1"
|
|
25
|
+
inkscape:document-units="mm"
|
|
26
|
+
showguides="true"
|
|
27
|
+
inkscape:zoom="0.5"
|
|
28
|
+
inkscape:cx="235"
|
|
29
|
+
inkscape:cy="297"
|
|
30
|
+
inkscape:window-width="1863"
|
|
31
|
+
inkscape:window-height="1066"
|
|
32
|
+
inkscape:window-x="0"
|
|
33
|
+
inkscape:window-y="0"
|
|
34
|
+
inkscape:window-maximized="1"
|
|
35
|
+
inkscape:current-layer="layer1" />
|
|
36
|
+
<defs
|
|
37
|
+
id="defs1">
|
|
38
|
+
<inkscape:path-effect
|
|
39
|
+
effect="bspline"
|
|
40
|
+
id="path-effect3"
|
|
41
|
+
is_visible="true"
|
|
42
|
+
lpeversion="1.3"
|
|
43
|
+
weight="33.333333"
|
|
44
|
+
steps="2"
|
|
45
|
+
helper_size="0"
|
|
46
|
+
apply_no_weight="true"
|
|
47
|
+
apply_with_weight="true"
|
|
48
|
+
only_selected="false"
|
|
49
|
+
uniform="false" />
|
|
50
|
+
</defs>
|
|
51
|
+
<g
|
|
52
|
+
inkscape:label="svg"
|
|
53
|
+
inkscape:groupmode="layer"
|
|
54
|
+
id="layer1"
|
|
55
|
+
style="display:inline">
|
|
56
|
+
<path
|
|
57
|
+
id="path8"
|
|
58
|
+
style="fill:#000000;fill-rule:evenodd;stroke-width:0"
|
|
59
|
+
d="m 131.31653,40.616643 38.65656,15.462624 -38.65656,15.46262 a 28,28 0 0 0 4.36925,-11.46287 H 129.97295 80.260218 47.216757 a 97.32504,97.32504 0 0 0 0.0822,-3.99872 97.32504,97.32504 0 0 0 -0.0822,-4.001305 h 33.043461 49.712732 5.71283 a 28,28 0 0 0 -4.36925,-11.462349 z" />
|
|
60
|
+
</g>
|
|
61
|
+
</svg>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="210mm"
|
|
6
|
+
height="297mm"
|
|
7
|
+
viewBox="0 0 210 297"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg1"
|
|
10
|
+
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
|
11
|
+
sodipodi:docname="radius_x14.svg"
|
|
12
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
13
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
16
|
+
<sodipodi:namedview
|
|
17
|
+
id="namedview1"
|
|
18
|
+
pagecolor="#ffffff"
|
|
19
|
+
bordercolor="#000000"
|
|
20
|
+
borderopacity="0.25"
|
|
21
|
+
inkscape:showpageshadow="2"
|
|
22
|
+
inkscape:pageopacity="0.0"
|
|
23
|
+
inkscape:pagecheckerboard="0"
|
|
24
|
+
inkscape:deskcolor="#d1d1d1"
|
|
25
|
+
inkscape:document-units="mm"
|
|
26
|
+
showguides="true"
|
|
27
|
+
inkscape:zoom="0.5"
|
|
28
|
+
inkscape:cx="235"
|
|
29
|
+
inkscape:cy="297"
|
|
30
|
+
inkscape:window-width="1863"
|
|
31
|
+
inkscape:window-height="1066"
|
|
32
|
+
inkscape:window-x="0"
|
|
33
|
+
inkscape:window-y="0"
|
|
34
|
+
inkscape:window-maximized="1"
|
|
35
|
+
inkscape:current-layer="layer1" />
|
|
36
|
+
<defs
|
|
37
|
+
id="defs1">
|
|
38
|
+
<inkscape:path-effect
|
|
39
|
+
effect="bspline"
|
|
40
|
+
id="path-effect3"
|
|
41
|
+
is_visible="true"
|
|
42
|
+
lpeversion="1.3"
|
|
43
|
+
weight="33.333333"
|
|
44
|
+
steps="2"
|
|
45
|
+
helper_size="0"
|
|
46
|
+
apply_no_weight="true"
|
|
47
|
+
apply_with_weight="true"
|
|
48
|
+
only_selected="false"
|
|
49
|
+
uniform="false" />
|
|
50
|
+
</defs>
|
|
51
|
+
<g
|
|
52
|
+
inkscape:label="svg"
|
|
53
|
+
inkscape:groupmode="layer"
|
|
54
|
+
id="layer1"
|
|
55
|
+
style="display:inline">
|
|
56
|
+
<path
|
|
57
|
+
id="path8"
|
|
58
|
+
style="fill:#000000;fill-rule:evenodd;stroke-width:0"
|
|
59
|
+
d="M 139.25352,27.387476 177.91059,42.8501 139.25352,58.31272 a 28,28 0 0 0 4.36976,-11.46287 H 137.91045 88.197718 35.153927 a 97.32504,97.32504 0 0 0 0.0822,-3.99872 97.32504,97.32504 0 0 0 -0.0822,-4.001305 h 53.043791 49.712732 5.71283 a 28,28 0 0 0 -4.36976,-11.462349 z" />
|
|
60
|
+
</g>
|
|
61
|
+
</svg>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="210mm"
|
|
6
|
+
height="297mm"
|
|
7
|
+
viewBox="0 0 210 297"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg1"
|
|
10
|
+
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
|
11
|
+
sodipodi:docname="radius_x16.svg"
|
|
12
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
13
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
16
|
+
<sodipodi:namedview
|
|
17
|
+
id="namedview1"
|
|
18
|
+
pagecolor="#ffffff"
|
|
19
|
+
bordercolor="#000000"
|
|
20
|
+
borderopacity="0.25"
|
|
21
|
+
inkscape:showpageshadow="2"
|
|
22
|
+
inkscape:pageopacity="0.0"
|
|
23
|
+
inkscape:pagecheckerboard="0"
|
|
24
|
+
inkscape:deskcolor="#d1d1d1"
|
|
25
|
+
inkscape:document-units="mm"
|
|
26
|
+
showguides="true"
|
|
27
|
+
inkscape:zoom="0.5"
|
|
28
|
+
inkscape:cx="235"
|
|
29
|
+
inkscape:cy="297"
|
|
30
|
+
inkscape:window-width="1863"
|
|
31
|
+
inkscape:window-height="1066"
|
|
32
|
+
inkscape:window-x="0"
|
|
33
|
+
inkscape:window-y="0"
|
|
34
|
+
inkscape:window-maximized="1"
|
|
35
|
+
inkscape:current-layer="layer1" />
|
|
36
|
+
<defs
|
|
37
|
+
id="defs1">
|
|
38
|
+
<inkscape:path-effect
|
|
39
|
+
effect="bspline"
|
|
40
|
+
id="path-effect3"
|
|
41
|
+
is_visible="true"
|
|
42
|
+
lpeversion="1.3"
|
|
43
|
+
weight="33.333333"
|
|
44
|
+
steps="2"
|
|
45
|
+
helper_size="0"
|
|
46
|
+
apply_no_weight="true"
|
|
47
|
+
apply_with_weight="true"
|
|
48
|
+
only_selected="false"
|
|
49
|
+
uniform="false" />
|
|
50
|
+
</defs>
|
|
51
|
+
<g
|
|
52
|
+
inkscape:label="svg"
|
|
53
|
+
inkscape:groupmode="layer"
|
|
54
|
+
id="layer1"
|
|
55
|
+
style="display:inline">
|
|
56
|
+
<path
|
|
57
|
+
id="path8"
|
|
58
|
+
style="fill:#000000;fill-rule:evenodd;stroke-width:0"
|
|
59
|
+
d="M 153.01185,32.149976 191.66892,47.6126 153.01185,63.07522 a 28,28 0 0 0 4.36976,-11.46287 h -5.71283 -49.71273 -73.0436 a 97.32504,97.32504 0 0 0 0.0822,-3.99872 97.32504,97.32504 0 0 0 -0.0822,-4.001305 h 73.0436 49.71273 5.71283 a 28,28 0 0 0 -4.36976,-11.462349 z" />
|
|
60
|
+
</g>
|
|
61
|
+
</svg>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="210mm"
|
|
6
|
+
height="297mm"
|
|
7
|
+
viewBox="0 0 210 297"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg1"
|
|
10
|
+
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
|
11
|
+
sodipodi:docname="radius_x18.svg"
|
|
12
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
13
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
16
|
+
<sodipodi:namedview
|
|
17
|
+
id="namedview1"
|
|
18
|
+
pagecolor="#ffffff"
|
|
19
|
+
bordercolor="#000000"
|
|
20
|
+
borderopacity="0.25"
|
|
21
|
+
inkscape:showpageshadow="2"
|
|
22
|
+
inkscape:pageopacity="0.0"
|
|
23
|
+
inkscape:pagecheckerboard="0"
|
|
24
|
+
inkscape:deskcolor="#d1d1d1"
|
|
25
|
+
inkscape:document-units="mm"
|
|
26
|
+
showguides="true"
|
|
27
|
+
inkscape:zoom="0.5"
|
|
28
|
+
inkscape:cx="235"
|
|
29
|
+
inkscape:cy="297"
|
|
30
|
+
inkscape:window-width="1863"
|
|
31
|
+
inkscape:window-height="1066"
|
|
32
|
+
inkscape:window-x="0"
|
|
33
|
+
inkscape:window-y="0"
|
|
34
|
+
inkscape:window-maximized="1"
|
|
35
|
+
inkscape:current-layer="layer1" />
|
|
36
|
+
<defs
|
|
37
|
+
id="defs1">
|
|
38
|
+
<inkscape:path-effect
|
|
39
|
+
effect="bspline"
|
|
40
|
+
id="path-effect3"
|
|
41
|
+
is_visible="true"
|
|
42
|
+
lpeversion="1.3"
|
|
43
|
+
weight="33.333333"
|
|
44
|
+
steps="2"
|
|
45
|
+
helper_size="0"
|
|
46
|
+
apply_no_weight="true"
|
|
47
|
+
apply_with_weight="true"
|
|
48
|
+
only_selected="false"
|
|
49
|
+
uniform="false" />
|
|
50
|
+
</defs>
|
|
51
|
+
<g
|
|
52
|
+
inkscape:label="svg"
|
|
53
|
+
inkscape:groupmode="layer"
|
|
54
|
+
id="layer1"
|
|
55
|
+
style="display:inline">
|
|
56
|
+
<path
|
|
57
|
+
id="path8"
|
|
58
|
+
style="fill:#000000;fill-rule:evenodd;stroke-width:0"
|
|
59
|
+
d="m 159.36236,28.445809 38.65656,15.462624 -38.65656,15.46262 a 28,28 0 0 0 4.36976,-11.46287 h -5.71283 -49.71324 -93.04342 a 97.32504,97.32504 0 0 0 0.0822,-3.99872 97.32504,97.32504 0 0 0 -0.0822,-4.001305 h 93.04342 49.71324 5.71283 a 28,28 0 0 0 -4.36976,-11.462349 z" />
|
|
60
|
+
</g>
|
|
61
|
+
</svg>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="210mm"
|
|
6
|
+
height="297mm"
|
|
7
|
+
viewBox="0 0 210 297"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg1"
|
|
10
|
+
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
|
11
|
+
sodipodi:docname="radius_x20.svg"
|
|
12
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
13
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
16
|
+
<sodipodi:namedview
|
|
17
|
+
id="namedview1"
|
|
18
|
+
pagecolor="#ffffff"
|
|
19
|
+
bordercolor="#000000"
|
|
20
|
+
borderopacity="0.25"
|
|
21
|
+
inkscape:showpageshadow="2"
|
|
22
|
+
inkscape:pageopacity="0.0"
|
|
23
|
+
inkscape:pagecheckerboard="0"
|
|
24
|
+
inkscape:deskcolor="#d1d1d1"
|
|
25
|
+
inkscape:document-units="mm"
|
|
26
|
+
showguides="true"
|
|
27
|
+
inkscape:zoom="0.5"
|
|
28
|
+
inkscape:cx="235"
|
|
29
|
+
inkscape:cy="297"
|
|
30
|
+
inkscape:window-width="1863"
|
|
31
|
+
inkscape:window-height="1066"
|
|
32
|
+
inkscape:window-x="0"
|
|
33
|
+
inkscape:window-y="0"
|
|
34
|
+
inkscape:window-maximized="1"
|
|
35
|
+
inkscape:current-layer="layer1" />
|
|
36
|
+
<defs
|
|
37
|
+
id="defs1">
|
|
38
|
+
<inkscape:path-effect
|
|
39
|
+
effect="bspline"
|
|
40
|
+
id="path-effect3"
|
|
41
|
+
is_visible="true"
|
|
42
|
+
lpeversion="1.3"
|
|
43
|
+
weight="33.333333"
|
|
44
|
+
steps="2"
|
|
45
|
+
helper_size="0"
|
|
46
|
+
apply_no_weight="true"
|
|
47
|
+
apply_with_weight="true"
|
|
48
|
+
only_selected="false"
|
|
49
|
+
uniform="false" />
|
|
50
|
+
</defs>
|
|
51
|
+
<g
|
|
52
|
+
inkscape:label="svg"
|
|
53
|
+
inkscape:groupmode="layer"
|
|
54
|
+
id="layer1"
|
|
55
|
+
style="display:inline">
|
|
56
|
+
<path
|
|
57
|
+
id="path8"
|
|
58
|
+
style="fill:#000000;fill-rule:evenodd;stroke-width:0"
|
|
59
|
+
d="m 167.29934,30.033309 38.65708,15.462624 -38.65708,15.46262 a 28,28 0 0 0 4.36976,-11.46287 H 165.95627 116.24355 3.1998 A 97.32504,97.32504 0 0 0 3.282,45.496963 97.32504,97.32504 0 0 0 3.1998,41.495658 h 113.04375 49.71272 5.71283 a 28,28 0 0 0 -4.36976,-11.462349 z" />
|
|
60
|
+
</g>
|
|
61
|
+
</svg>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="210mm"
|
|
6
|
+
height="297mm"
|
|
7
|
+
viewBox="0 0 210 297"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg1"
|
|
10
|
+
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
|
11
|
+
sodipodi:docname="template.svg"
|
|
12
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
13
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
16
|
+
<sodipodi:namedview
|
|
17
|
+
id="namedview1"
|
|
18
|
+
pagecolor="#ffffff"
|
|
19
|
+
bordercolor="#000000"
|
|
20
|
+
borderopacity="0.25"
|
|
21
|
+
inkscape:showpageshadow="2"
|
|
22
|
+
inkscape:pageopacity="0.0"
|
|
23
|
+
inkscape:pagecheckerboard="0"
|
|
24
|
+
inkscape:deskcolor="#d1d1d1"
|
|
25
|
+
inkscape:document-units="mm"
|
|
26
|
+
showguides="true"
|
|
27
|
+
inkscape:zoom="0.5"
|
|
28
|
+
inkscape:cx="234"
|
|
29
|
+
inkscape:cy="297"
|
|
30
|
+
inkscape:window-width="1863"
|
|
31
|
+
inkscape:window-height="1066"
|
|
32
|
+
inkscape:window-x="0"
|
|
33
|
+
inkscape:window-y="0"
|
|
34
|
+
inkscape:window-maximized="1"
|
|
35
|
+
inkscape:current-layer="layer1" />
|
|
36
|
+
<defs
|
|
37
|
+
id="defs1">
|
|
38
|
+
<inkscape:path-effect
|
|
39
|
+
effect="bspline"
|
|
40
|
+
id="path-effect3"
|
|
41
|
+
is_visible="true"
|
|
42
|
+
lpeversion="1.3"
|
|
43
|
+
weight="33.333333"
|
|
44
|
+
steps="2"
|
|
45
|
+
helper_size="0"
|
|
46
|
+
apply_no_weight="true"
|
|
47
|
+
apply_with_weight="true"
|
|
48
|
+
only_selected="false"
|
|
49
|
+
uniform="false" />
|
|
50
|
+
</defs>
|
|
51
|
+
<g
|
|
52
|
+
inkscape:label="svg"
|
|
53
|
+
inkscape:groupmode="layer"
|
|
54
|
+
id="layer1"
|
|
55
|
+
style="display:inline">
|
|
56
|
+
<path
|
|
57
|
+
id="path1"
|
|
58
|
+
style="fill:#ffffff;stroke:#00000f;stroke-width:5.34832;stroke-dasharray:none"
|
|
59
|
+
d="M 100.00128,2.6741614 A 97.32504,97.32504 0 0 0 2.67416,100.00127 97.32504,97.32504 0 0 0 100.00128,197.32584 97.32504,97.32504 0 0 0 197.32584,100.00127 97.32504,97.32504 0 0 0 100.00128,2.6741614 Z" />
|
|
60
|
+
<g
|
|
61
|
+
id="g1">
|
|
62
|
+
<path
|
|
63
|
+
id="path4"
|
|
64
|
+
style="fill:#a0892c;stroke:#0000be;stroke-width:0"
|
|
65
|
+
inkscape:transform-center-x="-3.3333331"
|
|
66
|
+
transform="matrix(-2.4389582,0,0,1.6897598,279.82388,41.335353)"
|
|
67
|
+
d="m 139.33157,25.248942 16.40045,9.468801 -16.40045,9.468801 z" />
|
|
68
|
+
<path
|
|
69
|
+
id="path5"
|
|
70
|
+
style="fill:#9ab1b9;stroke:#a2a2ff;stroke-width:0"
|
|
71
|
+
transform="scale(-1,1)"
|
|
72
|
+
d="m 66.000004,100 a 28,28 0 0 1 -28,28 28,28 0 0 1 -28,-28 28,28 0 0 1 28,-28 28,28 0 0 1 28,28 z" />
|
|
73
|
+
<path
|
|
74
|
+
id="rect6"
|
|
75
|
+
style="fill:#0000ff;fill-rule:evenodd;stroke-width:0"
|
|
76
|
+
transform="scale(-1,1)"
|
|
77
|
+
d="M -302.50458,96 H 69.441895 v 8 H -302.50458 Z" />
|
|
78
|
+
</g>
|
|
79
|
+
</g>
|
|
80
|
+
</svg>
|
algomanim/core/base.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Manim use notes:
|
|
3
|
+
|
|
4
|
+
- mobject.arrange() resets previous position
|
|
5
|
+
- fill_color requires fill_opacity=1 to be visible
|
|
6
|
+
- Simply assigning causes an unexpected shift in position:
|
|
7
|
+
example: var = mobject
|
|
8
|
+
- hasattr(mobject, "method_name") -> True (always), so it's bad idea to use it
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from typing import Literal
|
|
12
|
+
|
|
13
|
+
import numpy as np
|
|
14
|
+
import manim as mn
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AlgoManimBase(mn.VGroup):
|
|
18
|
+
"""Base class for all algomanim classes.
|
|
19
|
+
|
|
20
|
+
Warning:
|
|
21
|
+
This is base class only, cannot be instantiated directly.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
vector (np.ndarray): Position offset from mob_center.
|
|
25
|
+
mob_center (mn.Mobject): Reference mobject for positioning.
|
|
26
|
+
align_edge (Literal["up", "down", "left", "right"] | None): Edge alignment.
|
|
27
|
+
**kwargs: Additional keyword arguments passed to VGroup.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(
|
|
31
|
+
self,
|
|
32
|
+
vector: np.ndarray = mn.ORIGIN,
|
|
33
|
+
mob_center: mn.Mobject = mn.Dot(mn.ORIGIN),
|
|
34
|
+
align_edge: Literal["up", "down", "left", "right"] | None = None,
|
|
35
|
+
**kwargs,
|
|
36
|
+
):
|
|
37
|
+
if type(self) is AlgoManimBase:
|
|
38
|
+
raise NotImplementedError(
|
|
39
|
+
"AlgoManimBase is base class only, cannot be instantiated directly."
|
|
40
|
+
)
|
|
41
|
+
super().__init__(**kwargs)
|
|
42
|
+
self._vector = vector
|
|
43
|
+
self._mob_center = mob_center
|
|
44
|
+
self._align_edge: Literal["up", "down", "left", "right"] | None = align_edge
|
|
45
|
+
|
|
46
|
+
def first_appear(self, scene: mn.Scene, time=0.5):
|
|
47
|
+
"""Animate the initial appearance in scene.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
scene: The scene to play the animation in.
|
|
51
|
+
time: Duration of the fade-in animation.
|
|
52
|
+
"""
|
|
53
|
+
scene.play(mn.FadeIn(self), run_time=time)
|
|
54
|
+
|
|
55
|
+
def appear(self, scene: mn.Scene):
|
|
56
|
+
"""Add VGroup the given scene.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
scene: The scene to add the logo group to.
|
|
60
|
+
"""
|
|
61
|
+
scene.add(self)
|
|
62
|
+
|
|
63
|
+
def _position(
|
|
64
|
+
self,
|
|
65
|
+
mobject_to_move: mn.Mobject,
|
|
66
|
+
align_point: mn.Mobject,
|
|
67
|
+
) -> None:
|
|
68
|
+
"""Position mobject relative to center with optional edge alignment.
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
mobject_to_move (mn.Mobject): The object to position.
|
|
72
|
+
align_point (mn.Mobject): Reference point object for alignment.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
align_edge = self._align_edge.lower() if self._align_edge else None
|
|
76
|
+
|
|
77
|
+
if hasattr(self._mob_center, "_get_positioning"):
|
|
78
|
+
mob_center = self._mob_center._get_positioning()
|
|
79
|
+
else:
|
|
80
|
+
mob_center = self._mob_center
|
|
81
|
+
|
|
82
|
+
mobject_point = align_point.get_center()
|
|
83
|
+
target_point = mob_center.get_center() + self._vector
|
|
84
|
+
|
|
85
|
+
if align_edge:
|
|
86
|
+
if align_edge == "left":
|
|
87
|
+
mobject_point = align_point.get_left()
|
|
88
|
+
target_point = mob_center.get_left() + self._vector
|
|
89
|
+
|
|
90
|
+
elif align_edge == "right":
|
|
91
|
+
mobject_point = align_point.get_right()
|
|
92
|
+
target_point = mob_center.get_right() + self._vector
|
|
93
|
+
|
|
94
|
+
elif align_edge == "up":
|
|
95
|
+
mobject_point = align_point.get_top()
|
|
96
|
+
target_point = mob_center.get_top() + self._vector
|
|
97
|
+
|
|
98
|
+
elif align_edge == "down":
|
|
99
|
+
mobject_point = align_point.get_bottom()
|
|
100
|
+
target_point = mob_center.get_bottom() + self._vector
|
|
101
|
+
|
|
102
|
+
shift_vector = target_point - mobject_point
|
|
103
|
+
mobject_to_move.shift(shift_vector)
|