Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay in new line when Horizontally Centered is true #68

Closed
PROxZIMA opened this issue Oct 24, 2021 · 4 comments
Closed

Delay in new line when Horizontally Centered is true #68

PROxZIMA opened this issue Oct 24, 2021 · 4 comments
Labels
bug Something isn't working no-issue-activity No activity in 30+ days

Comments

@PROxZIMA
Copy link
Contributor

Describe the bug
There is a noticeable delay in new lines when Horizontally Centered is set to true AND width of the line is less than width of the svg

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://readme-typing-svg.herokuapp.com/demo/
  2. Add lines There is no problem in this line as it is long., But this takes, time to appear :(
  3. Set Horizontally Centered to true
  4. See error

Expected behavior
No delay in occurrence of new line is expected

Screenshots

Readme.Typing.SVG.mp4

Desktop (please complete the following information):

  • OS: Linux(Pop!_OS)
  • Browser: Firefox
  • Version: v93
@PROxZIMA PROxZIMA added the bug Something isn't working label Oct 24, 2021
@DenverCoder1
Copy link
Owner

This is the intended behavior and is the only way it can work. See this comment for why it happens - #12 (comment).

If you want to remove the delay, make the text longer to fill the full width or make the width smaller

@PROxZIMA
Copy link
Contributor Author

PROxZIMA commented Oct 24, 2021

I thought of using width of text as the key element.

Let width of text in a line be textWidth.
Let startPosition = (svgWidth - textWidth) / 2

Then the value attribute in <animate> element will be something like this

m<startPosition>,25 h0 ; m<startPosition>,25 h<textWidth> ; m<startPosition>,25 h0

This will start the animation from beginning of the text as well as center the text
and also eliminate use of x="50%" text-anchor="middle" in <text>

@DenverCoder1
Copy link
Owner

The issue is that it is difficult to find out the textWidth since you can only really know exactly how long it will be after it is rendered.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity No activity in 30+ days
Projects
None yet
Development

No branches or pull requests

2 participants