ManimCommunity / ManimCommunity/manim
Unexpected result using TracePath when used with stroke_opacity=[0, 1]
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
I used TracePath to animate the path an object traces as it moves. When using TracePath with the stroke_opacity=[0, 1] (transparent at one end, opaque at the other) the traced path opacity does not behave as I expected. The "opacity direction" (opaque->transparent) is always up->down or left->right. It does not depend on the direction the object moved.
In other words, the opacity direction is fixed and does not depend on the movement direction of movement of the object being traced.
Note that if you change the stroke_opacity to stroke_opacity=[1, 0], the direction will change. I.e., it will become down->up or right->left.
## Expected behavior
My expectation was that the end of the path (final position of the object) trace be opaque and then fade to transparent at the start of the path (initial position of the object). I expect that to be true regardless of the direction the object moved.
In other words, at the end of a movement, I expected the path to be opaque at the object and fade to transparent at the initial position of the object.
## How to reproduce the issue
Code for reproducing the problem
```py
from manim import *
class DissipatingPathExample(Scene):
def construct(self):
a = Dot(RIGHT*2)
b = TracedPath(a.get_center, dissipating_time=0.5, stroke_opacity=[0, 1])
self.add(a, b)
self.play(a.animate().shift(DOWN*2))
self.play(a.animate().shift(LEFT*4))
self.play(a.animate().shift(UP*2))
self.play(a.animate().shift(RIGHT*4))
self.wait()
```
## Additional media files
https://github.com/ManimCommunity/manim/assets/8999134/7221b333-dde0-408d-8dd0-e8da4fe4e603
Images/GIFs

## Logs
Terminal output
```
PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR
```
## System specifications
System Details
- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):
- RAM:
- Python version (`python/py/python3 --version`):
- Installed modules (provide output from `pip list`):
```
PASTE HERE
```
LaTeX details
+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:
FFMPEG
Output of `ffmpeg -version`:
```
PASTE HERE
```
## Additional comments
I was following the example from here:
[DissipatingPathExample](https://docs.manim.community/en/stable/reference/manim.animation.changing.TracedPath.html)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the TracedPath reference example and run the supplied DissipatingPathExample reproducer first. Then locate the TracedPath implementation and its opacity handling; done means the trace fades from transparent at the initial position to opaque at the object's final position regardless of movement direction, with the reproduced behavior verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100