question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to achieve a line with different styles of starting/ending tip?

See original GitHub issue

Hello, I’m new here

I’m trying to create a scene that has a line with a dot in ending/starting. It would look like this…

image

I’m following this doc, I tried to run the following code:

class Viterbi(Scene):
    def construct(self):
        arrow = Arrow(np.array([0, 0, 0]), np.array([1, 1, 0]), tip_shape=ArrowCircleTip)
        self.add(arrow)
        self.wait()

I received this warning:

NameError: name 'ArrowCircleTip' is not defined

I am not a specialist in reading documents, but based in this doc, manim.mobject.geometry.ArrowCircleFilledTip means that the class ArrowCircleFilledTip should be located in manim/mobject/geometry.py, doesn’t?

Anyway, this path doesn’t exist. But I found the path manim/manimlib/mobject/geometry.py, and there isn’t the statement of the ArrowCircleTip class. If I’m not wrong, I should find this class there. That’s the problem? how can I solve it?

I have an interesting case:

  1. When I change ArrowCircleTip to RegularPolygon (which exists inmanim/manimlib/mobject/geometry.py), this code still gives me an arrow-styled line, that is image

PS: Sorry if this question is stupid, I didn’t find it anywhere…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
NeoPlatocommented, Sep 18, 2020

I don’t really know if I can give fully accurate advice.

Best plan: go for the community version. It’s in the name, help and documentation will be closer to you than in the main version.

1reaction
NeoPlatocommented, Sep 18, 2020

You mean this?

class ArrowCircleTip(Line):
    def __init__(self, *args, **kwargs):
        Line.__init__(self, *args, **kwargs)
        self.add_dot_tip()

    def add_dot_tip(self, tip_length=None, at_start=True):
        """
        Returns a tip that has been stylistically configured,
        but has not yet been given a position in space.
        """
        if tip_length is None:
            tip_length = DEFAULT_DOT_RADIUS
        color = self.get_color()
        style = {
            "fill_color": color,
            "stroke_color": color
        }
        style.update(self.tip_style)
        tip = Dot(radius=tip_length, **style)
        tip.move_to(self.get_end())
        self.add(tip)
        if at_start:
            end_tip = tip.copy()
            end_tip.move_to(self.get_start())
            self.add(end_tip)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Tikz paths not starting/ending at edges of nodes
This two step process you are doing can be done with the definition of a node like mynode/.style={pattern=north east lines, circle, ...
Read more >
7 Tips and Tricks to Improve Your Chart's Readability
This blog provides 7 useful tips to improve the readability of a chart in any application. This addresses many of the common mistakes...
Read more >
methods - Python - how to abstract common starting/ending code ...
The {do stuff} code will never be reused (it is different for each method);; It makes the program flow more confusing / less...
Read more >
HOW TO SET DIFFERENT STYLES FOR MULTIPLE LINES
What do you specifically mean by "style"? Expressions? Layer Styles? Basic text formattting? Something else? You need to clarify and explain better.
Read more >
Starting/Ending Printer Writers without Granting *JOBCTL and ...
A* CMDPROMPT DO NOT DELETE THIS DDS SPEC. ... On the operating system command line, type the following commands exactly as shown and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found