Creating own VMobjects
See original GitHub issueI want to create an own VMobject. My code looks like this:
from manimlib.imports import *
class Myobject(VMobject):
def __init__(self, offset, **kwargs):
self.offset= offset
VMobject.__init__(self, **kwargs)
def generate_points(self):
self.term = Square()
self.term.set_style(fill_color=GREEN, fill_opacity=1)
self.term.move_to(RIGHT*self.offset)
self.add(self.term)
class MyExample(Scene):
def construct(self):
d1 = Square()
d1.set_style(fill_color=GREEN, fill_opacity=1)
self.add(d1)
d2= Myobject(offset=3)
self.add(d2)
but the image looks like this
Problem: The color is lost.
I guess I have to add something like init_colors().
I am grateful for any advice
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
VMobject - Manim Community v0.17.1 - Docs
Creates a smooth curve from given points and add it to the VMobject. If two points are passed in, the first is interpreted...
Read more >How to use the manimlib.mobject.types.vectorized_mobject ...
To help you get started, we've selected a few manimlib.mobject.types.vectorized_mobject.VMobject examples, based on popular ways it is used in public ...
Read more >Animate homemade mobject : r/manim - Reddit
I've created a custom mobject by inheriting from VMobject and pretty much everything is working as expected. I'm able to move it around...
Read more >2. VM Objects - FreeBSD Documentation
This model creates a number of potential problems. The first is that you can wind up with a relatively deep stack of layered...
Read more >vmobject | Flutter Package - Pub.dev
A widget auto rebuild every time the observable changed ... In somewhere, you can use ViewModel.of to get created objects already.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I correct my previous comment, the reason why it does not recognize the color is due to the structure of Mobject (manimlib/mobject/mobject.py):
Then, the correct way is:
Please close the issue.
However, a more correct way to do this is: