Closed semikernel closed 4 months ago
Hello, can you please show the full code? Or at least a minimal working example (MWE)?
Hello, can you please show the full code? Or at least a minimal working example (MWE)?
Yes of course! The origin code is very simple:
from manim import * # or: from manimlib import *
from manim_slides import Slide
class BasicExample(Slide):
def construct(self):
circle = Circle(radius=3, color=BLUE)
dot = Dot()
self.play(GrowFromCenter(circle))
self.play(self.camera.frame.animate.scale(2))
self.next_slide() # Waits user to press continue to go to the next slide
self.add()
self.next_slide(loop=True) # Start loop
self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
self.play(self.camera.frame.animate.scale(0.5))
self.next_slide() # This will start a new non-looping slide
self.play(dot.animate.move_to(ORIGIN))
And it returns that:
Manim Community v0.18.0
/usr/lib/python3.10/runpy.py:126: RuntimeWarning: 'manim.__main__' found in sys.modules after import of package 'manim', but prior to execution of 'manim.__main__'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
Manim Community v0.18.0
[03/05/24 22:08:52] INFO Animation 0 : Partial scene_file_writer.py:527
movie file written in
'/home/semikernel/Tiktok/S
lides/media/videos/mwe/108
0p60/partial_movie_files/B
asicExample/3977891868_636
512264_223132457.mp4'
╭───────────────────── 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/Slides/mwe.py:11 in construct │
│ │
│ 8 │ │ circle = Circle(radius=3, color=BLUE) │
│ 9 │ │ dot = Dot() │
│ 10 │ │ self.play(GrowFromCenter(circle)) │
│ ❱ 11 │ │ self.play(self.camera.frame.animate.scale(2)) │
│ 12 │ │ self.next_slide() # Waits user to press continue to go to the │
│ 13 │ │ self.add() │
│ 14 │ │ self.next_slide(loop=True) # Start loop │
╰──────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'Camera' object has no attribute 'frame'
I tried manim v13.0 and it still doesn't work.
Hello, can you please show the full code? Or at least a minimal working example (MWE)?
Sorry for that, I confused manim and manimce. In manim Scene camera have attribute frame but in manimCE it should be MovingCameraScene. Sincerely sorry again for wasting your precious time!
Hello, can you please show the full code? Or at least a minimal working example (MWE)?
Sorry for that, I confused manim and manimce. In manim Scene camera have attribute frame but in manimCE it should be MovingCameraScene. Sincerely sorry again for wasting your precious time!
No issue! This is what I was going to suppose, it is easy to mix ManimGL and ManmCE code. In general, I would recommend only using ManimCE, because ManimGL gets very infrequent updates...
Closing this as this is not a Manim Slides issue, and it has been solved by using the correct functions / attributes.
Please explain the issue you're experiencing (with as much detail as possible):
I can't use
It said that
I am using manim v18.0, and this camera feature works well in manim
So could I use camera animations by other way else? Thx a lot!