Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Eli Sohl committed May 17, 2024
1 parent 574102c commit c0c0ae8
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 33 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# cranim

Manim toolkit for cryptographic scenes.
Manim toolkit for cryptographic scenes. Check out the example gallery: [https://nccgroup.github.io/manim-cranim/](https://nccgroup.github.io/manim-cranim/)

Local install: clone the repo locally and run `pip install -e .` from the repo's root directory (or `pip install .` if you don't expect to ever make local changes).

In lieu of documentation (for now), please see the code samples and associated renders in the [example gallery](examples/index.md).
Local install: From the repo's root directory, run `pip install -e .` (or `pip install .` if you don't expect to ever make local changes).

This is a Manim plugin. Manim requires plugins to be explicitly enabled using a command-line flag or `manim.cfg` file.
See e.g. the example in [tests/manim.cfg](tests/manim.cfg), or the official [Manim docs](https://docs.manim.community/en/stable/plugins.html#using-plugins-in-projects) for more info.

cranim is documented by example; in lieu of API docs, please see the code samples and associated renders in the [example gallery](https://nccgroup.github.io/manim-cranim/).
2 changes: 1 addition & 1 deletion docs/ Showcase.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ECBvsCBCExample(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/CTSExample_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/CTSExample_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down
2 changes: 1 addition & 1 deletion docs/BendyArrow.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/BendyArrowExample1_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/BendyArrowExample1_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down
4 changes: 2 additions & 2 deletions docs/Block.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class BlockExample1(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/BlockExample2_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/BlockExample2_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand All @@ -91,7 +91,7 @@ class BlockExample2(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/BlockExample3_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/BlockExample3_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down
2 changes: 1 addition & 1 deletion docs/ByteBox.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/ByteBoxExample1_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/ByteBoxExample1_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down
8 changes: 4 additions & 4 deletions docs/CBCBlock.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/CBCExample1_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/CBCExample1_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand All @@ -13,7 +13,7 @@ class CBCExample1(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/CBCExample2_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/CBCExample2_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand All @@ -28,7 +28,7 @@ class CBCExample2(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/CBCExample3_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/CBCExample3_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down Expand Up @@ -86,7 +86,7 @@ class CBCExample4(MovingCameraScene): # Loops seamlessly
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/CBCExample5_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/CBCExample5_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down
4 changes: 2 additions & 2 deletions docs/ECBBlock.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/ECBExample1_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/ECBExample1_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down Expand Up @@ -33,7 +33,7 @@ class ECBExample3(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/ECBExample4_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/ECBExample4_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down
2 changes: 1 addition & 1 deletion docs/ECBBlocks.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/ECBExample2_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/ECBExample2_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down
4 changes: 2 additions & 2 deletions docs/FuncBox.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/FuncBoxExample1_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/FuncBoxExample1_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand All @@ -12,7 +12,7 @@ class FuncBoxExample1(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/FuncBoxExample2_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/FuncBoxExample2_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down
28 changes: 14 additions & 14 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ECBvsCBCExample(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/CTSExample_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/CTSExample_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down Expand Up @@ -155,7 +155,7 @@ class CodeRewriteExample1(Scene):


{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/BendyArrowExample1_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/BendyArrowExample1_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down Expand Up @@ -259,7 +259,7 @@ class BlockExample1(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/BlockExample2_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/BlockExample2_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand All @@ -276,7 +276,7 @@ class BlockExample2(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/BlockExample3_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/BlockExample3_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down Expand Up @@ -374,7 +374,7 @@ class BufferToTextExample1(Scene):


{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/ByteBoxExample1_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/ByteBoxExample1_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down Expand Up @@ -442,7 +442,7 @@ class ByteBoxExample2(Scene):


{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/CBCExample1_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/CBCExample1_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand All @@ -455,7 +455,7 @@ class CBCExample1(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/CBCExample2_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/CBCExample2_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand All @@ -470,7 +470,7 @@ class CBCExample2(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/CBCExample3_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/CBCExample3_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down Expand Up @@ -528,7 +528,7 @@ class CBCExample4(MovingCameraScene): # Loops seamlessly
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/CBCExample5_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/CBCExample5_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down Expand Up @@ -598,7 +598,7 @@ class CycleExample1(Scene):


{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/ECBExample1_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/ECBExample1_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down Expand Up @@ -631,7 +631,7 @@ class ECBExample3(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/ECBExample4_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/ECBExample4_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand All @@ -647,7 +647,7 @@ class ECBExample4(Scene):


{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/ECBExample2_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/ECBExample2_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand All @@ -661,7 +661,7 @@ class ECBExample2(Scene):


{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/FuncBoxExample1_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/FuncBoxExample1_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand All @@ -673,7 +673,7 @@ class FuncBoxExample1(Scene):
-----

{::nomarkdown}
<video controls allowfullscreen width=100%> <source src="renders/FuncBoxExample2_ManimCE_v0.18.1.png" type="video/mp4"> </video>
<img src="renders/FuncBoxExample2_ManimCE_v0.18.1.png" width=100%>
{:/nomarkdown}

```python
Expand Down
8 changes: 7 additions & 1 deletion tests/gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,15 +664,21 @@ def _write_scenes_to_file(outfile, scenes):
else:
print("[*] Skipping re-rendering scene", scene_name)

if dest.endswith(".mp4"):
embed = f'<video controls allowfullscreen width=100%> <source src="{dest[9:]}" type="video/mp4"> </video>'
else:
embed = f'<img src="{dest[9:]}" width=100%>'

entries.append(f"""
{{::nomarkdown}}
<video controls allowfullscreen width=100%> <source src="{dest[9:]}" type="video/mp4"> </video>
{embed}
{{:/nomarkdown}}
```python
{_trim(inspect.getsource(Scene))}
```
""")

with open(outfile, "w") as f:
f.write("\n-----\n".join(entries))

Expand Down

0 comments on commit c0c0ae8

Please sign in to comment.