-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add setup function to make it easier to use
- Loading branch information
1 parent
0a9626d
commit 9c12f87
Showing
6 changed files
with
30 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,5 @@ name = "manimforge" | |
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
num-traits = "0.2.19" | ||
numpy = "0.21.0" | ||
pyo3 = "0.21.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
from manimforge.cairo import CairoCamera | ||
import manimforge as mf | ||
from manim import * | ||
|
||
def set_cairo_context_path(self, ctx, vmobject): | ||
points = self.transform_points_pre_display(vmobject, vmobject.points) | ||
if len(points) == 0: | ||
return | ||
CairoCamera().set_cairo_context_path(ctx, vmobject, np.asarray(points, dtype=np.float64)) | ||
return self | ||
|
||
# Monkeypatch the method | ||
Camera.set_cairo_context_path = set_cairo_context_path | ||
|
||
mf.setup() | ||
|
||
# Example Scene | ||
class Test(Scene): | ||
def construct(self): | ||
circle = Circle() | ||
self.play(Create(circle)) | ||
|
||
if __name__ == "__main__": | ||
config.preview = True | ||
config.disable_caching = True | ||
Test().render() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from .manimforge import * | ||
|
||
__doc__ = manimforge.__doc__ | ||
if hasattr(manimforge, "__all__"): | ||
__all__ = manimforge.__all__ | ||
|
||
|
||
from ._setup import setup as setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import numpy as np | ||
from manim import Camera | ||
|
||
from . import cairo | ||
|
||
|
||
def setup(): | ||
def set_cairo_context_path(self, ctx, vmobject): | ||
points = self.transform_points_pre_display(vmobject, vmobject.points) | ||
if len(points) == 0: | ||
return | ||
cairo.CairoCamera().set_cairo_context_path(ctx, vmobject, np.asarray(points, dtype=np.float64)) | ||
return self | ||
|
||
# Monkeypatch the method | ||
Camera.set_cairo_context_path = set_cairo_context_path | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters