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

Easier line drawing #105

Open
xedef opened this issue Jan 20, 2017 · 3 comments
Open

Easier line drawing #105

xedef opened this issue Jan 20, 2017 · 3 comments
Labels
feature feature request to implement
Projects

Comments

@xedef
Copy link

xedef commented Jan 20, 2017

I've tried all Shape properties when trying to draw a line that grows in length, but I couldn't find a easy way to do it. Please (point me in the right direction and) close this issue if I'm mistaken.

My problem is that as the property that determines the line length is radius, so:

  1. The length will be half of the value that we'll try to use intuitively when drawing a line (not biggie, though)
  2. The origin of the line is the center and not an end so when it grows, it does it to both sides (a little inconvenience)
  3. When trying to draw a line that grows from an point in a certain angle, I have to calculate the final x and y values, based in not only the trigonometric for the sin and cos of the angle, but also, the x and y that the origin has moved because of the origin that is placed in the center. (aarrgh)

Again, it seems that this is too complex and that leads me to think that I'm doing something very wrong, but I couldn't find any other properties that will let me do what I want.

Thanks.

@legomushroom
Copy link
Member

Hi @xedef!

Thanks for the issue and sorry for the troubles! You are right Shape was not intended for drawing lines from one point to another so it is hard.

There is one way for easy line animation with help of strokeDash properties - demo. It doesn't help with the #3 on your list, though.

If it is ok to create an overlay and a <path /> yourself - you can use Html module to animate the strokeDash on your path - demo.

So yeah, there is no easy way for that right now. I will mark this one as enhancement and try to add something more convenient for line drawings. Thanks for the feedback!

@legomushroom legomushroom added the feature feature request to implement label Jan 20, 2017
@xedef
Copy link
Author

xedef commented Jan 20, 2017

Ah, ok. At least I feel better with myself. Thanks for the help! I think I'm gonna go with the Html module option.
BTW, mojs is awesome!

@legomushroom
Copy link
Member

@xedef thank you! 👍 Please let me know if something.

@xavierfoucrier xavierfoucrier added this to Features in mojs@next Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature feature request to implement
Projects
No open projects
mojs@next
Features
Development

No branches or pull requests

2 participants