ManimCommunity / ManimCommunity/manim

DashedVMobject should have dash_legth much like DashedLine

Open
#3,996 3 comments 0 reactions 0 assignees View on GitHub
new feature
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## Description of proposed feature
DashedVMobject should allow for fixed-length dashes independent of the length of the underlying curves. DashedLine does, by computing the length of the curve in `__init__` (see #3989), but DashedVMobject does not. This makes animated dashed CubicBeziers for example quite ugly, since their dashes will be stretched, leading not only to temporal inconsistencies, but also to inconsistencies between different-length curves (unless users find ways to compute the correct num_dashes, which I did not yet).

## How can the new feature be used?
Connections between entities can be visualized with lines or curves, the style of which conveys some meaning (type of connection / relation). If the dash length is consistent, the style will be perceived as the same, so it is possible to use dashing as an indication of the type of connection / relation.

## Additional comments
I looked into the implementation myself, and initially thought the reason for this is that the length of arbitrary VMobjects is hard to compute / not available. However, there is already the `equal_lengths` argument (defaulting to `True`), which causes the approximate length to be computed.

When further trying to come up with a PR, I found that the current default of `num_dashes=15` prevents a backwards-compatible introduction of `dash_length: float = DEFAULT_DASH_LENGTH` as in DashedLine. I would suggest to really have the latter as new default behavior, but that is obviously something to be discussed and decided on.

Contributor guide

Open the contributing guide

Research direction

Start by comparing DashedVMobject with DashedLine, especially their __init__ implementations and the existing equal_lengths behavior. Review issue #3989 and determine how a fixed dash_length should interact with num_dashes and backward compatibility. Done means the chosen API and default behavior are implemented and validated for curves of different lengths and animated CubicBeziers.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.