Comments (5)
Hello! Can you share a minimal working example here? The error message looks weird, but I don't know what 'P9'
is referring to.
from manim-slides.
Hello! Can you share a minimal working example here? The error message looks weird, but I don't know what
'P9'
is referring to.
P9 is a class ZoomedCameraScene created by me, it doesn't matter what P9 is, because the second code in manim doc can't run, too.
I tested that the following code can run in manim-slides:
class ZoomedSlide(Slide, ZoomedScene):
pass
class UseZoomedScene(ZoomedSlide):
def construct(self):
dot = Dot().set_color(GREEN)
self.add(dot)
self.wait(1)
self.activate_zooming(animate=False)
self.wait(1)
self.play(dot.animate.shift(LEFT))
However, the following code in manim doc can't run:
class ChangingZoomScale(ZoomedSlide):
def __init__(self, **kwargs):
ZoomedScene.__init__(
self,
zoom_factor=0.3,
zoomed_display_height=1,
zoomed_display_width=3,
image_frame_stroke_width=20,
zoomed_camera_config={
"default_frame_stroke_width": 3,
},
**kwargs
)
def construct(self):
dot = Dot().set_color(GREEN)
sq = Circle(fill_opacity=1, radius=0.2).next_to(dot, RIGHT)
self.add(dot, sq)
self.wait(1)
self.activate_zooming(animate=False)
self.wait(1)
self.play(dot.animate.shift(LEFT * 0.3))
self.play(self.zoomed_camera.frame.animate.scale(4))
self.play(self.zoomed_camera.frame.animate.shift(0.5 * DOWN))
The terminal prompt outputs:
[04/04/24 17:53:57] INFO Animation 0 : Using cached cairo_renderer.py:78
data (hash :
1172816777_4205520711_22093568
1)
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /home/semikernel/.local/lib/python3.10/site-packages/manim/cli/render/comman │
│ ds.py:115 in render │
│ │
│ 112 │ │ │ try: │
│ 113 │ │ │ │ with tempconfig({}): │
│ 114 │ │ │ │ │ scene = SceneClass() │
│ ❱ 115 │ │ │ │ │ scene.render() │
│ 116 │ │ │ except Exception: │
│ 117 │ │ │ │ error_console.print_exception() │
│ 118 │ │ │ │ sys.exit(1) │
│ │
│ /home/semikernel/.local/lib/python3.10/site-packages/manim_slides/slide/mani │
│ m.py:93 in render │
│ │
│ 90 │ │ max_files_cached = config["max_files_cached"] │
│ 91 │ │ config["max_files_cached"] = float("inf") │
│ 92 │ │ │
│ ❱ 93 │ │ super().render(*args, **kwargs) │
│ 94 │ │ │
│ 95 │ │ config["max_files_cached"] = max_files_cached │
│ 96 │
│ │
│ /home/semikernel/.local/lib/python3.10/site-packages/manim/scene/scene.py:22 │
│ 3 in render │
│ │
│ 220 │ │ """ │
│ 221 │ │ self.setup() │
│ 222 │ │ try: │
│ ❱ 223 │ │ │ self.construct() │
│ 224 │ │ except EndSceneEarlyException: │
│ 225 │ │ │ pass │
│ 226 │ │ except RerunSceneException as e: │
│ │
│ /home/semikernel/Tiktok/ReportSlides/report411.py:81 in construct │
│ │
│ 78 │ │ dot = Dot().set_color(GREEN) │
│ 79 │ │ sq = Circle(fill_opacity=1, radius=0.2).next_to(dot, RIGHT) │
│ 80 │ │ self.add(dot, sq) │
│ ❱ 81 │ │ self.wait(1) │
│ 82 │ │ self.activate_zooming(animate=False) │
│ 83 │ │ self.wait(1) │
│ 84 │ │ self.play(dot.animate.shift(LEFT * 0.3)) │
│ │
│ /home/semikernel/.local/lib/python3.10/site-packages/manim/scene/scene.py:11 │
│ 22 in wait │
│ │
│ 1119 │ │ -------- │
│ 1120 │ │ :class:`.Wait`, :meth:`.should_mobjects_update` │
│ 1121 │ │ """ │
│ ❱ 1122 │ │ self.play( │
│ 1123 │ │ │ Wait( │
│ 1124 │ │ │ │ run_time=duration, │
│ 1125 │ │ │ │ stop_condition=stop_condition, │
│ │
│ /home/semikernel/.local/lib/python3.10/site-packages/manim_slides/slide/base │
│ .py:263 in play │
│ │
│ 260 │ def play(self, *args: Any, **kwargs: Any) -> None: │
│ 261 │ │ """Overload `self.play` and increment animation count.""" │
│ 262 │ │ super().play(*args, **kwargs) # type: ignore[misc] │
│ ❱ 263 │ │ self._current_animation += 1 │
│ 264 │ │
│ 265 │ @BaseSlideConfig.wrapper("base_slide_config") │
│ 266 │ def next_slide( │
╰──────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'ChangingZoomScale' object has no attribute '_current_animation
from manim-slides.
The error is caused by your __init__
method, because it does not call Slide.__init__
.
Just change:
class ChangingZoomScale(ZoomedSlide):
def __init__(self, **kwargs):
- ZoomedScene.__init__(
+ ZoomedSlide.__init__(
self,
zoom_factor=0.3,
zoomed_display_height=1,
zoomed_display_width=3,
image_frame_stroke_width=20,
zoomed_camera_config={
"default_frame_stroke_width": 3,
},
**kwargs
)
and this should work as expected :-)
from manim-slides.
ZoomedSlide.__init__
What a nicety point, now it works!
from manim-slides.
Happy I solved your issue :D
Closing this now.
from manim-slides.
Related Issues (20)
- [BUG] manim_slides giving qtpy.QtBindingsNotFoundError: No Qt bindings could be found error. HOT 13
- [BUG] Manim Slides Showing Black Screen Only HOT 7
- [DOC] Add a known / common issues page
- [CHORE] Update issues and PR templates
- [DOC] Add example gallery HOT 2
- Force re-render in manim-slides HOT 1
- [BUG] Background color is not correctly detected/used when using `manim-slides convert`
- [DOC] Add performance tips for large presentations
- [FEATURE] Drop opencv-python
- [BUG] Flickering at slide change for stand alone html HOT 4
- [BUG] Slides are shuffled when exporting mutliple files to revealjs format HOT 5
- [BUG] Non monotonically increasing dts HOT 5
- [BUG] 'OpenGLCamera' object has no attribute 'background_color' when rendering using manim.opengl HOT 3
- [BUG] Problem about Rust during installation. HOT 1
- [BUG] `utils.reverse_video_file` causes excessive RAM usage HOT 11
- [BUG] `manim-slides present` and `wizard` immediately crash HOT 10
- [FEATURE] Allow for waiting until loop is complete before switching slide HOT 5
- [FEATURE] Provide a `htmlzip` export format for zipped HTML
- [FEATURE] Add `--offline` option for HTML convert
- [FEATURE] Allow class-level configuration of slides rendering
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from manim-slides.