Jump to content

Pixi Graphics multiple lineTo same position


Recommended Posts

I am trying to animate drawing a line following the method here.




I found out that when lineTo method is called to the same position line dissapears.


graphic.lineTo(100, 100);

graphic.lineTo(100, 100);


Take a look at this jsbin. http://jsbin.com/goqaxopu/1/edit?html,js,output


Is this intended behaviour or a bug?

Link to comment
Share on other sites

Why would you draw the line to the same position twice concurrently? This would just create a 0 length line at the end of the last line - which I guess is confusing the WebGL line renderer and causing the line to disappear. The problem does not happen if you force pixi to use CanvasRenderer:

	var renderer = new PIXI.CanvasRenderer(620, 380);

I can't think of a valid reason why you'd ever want to call lineTo to the same position twice without at least a moveTo in-between to set a new starting point.

Link to comment
Share on other sites

I was trying to draw animated line, using tweens sometimes same number gets called twice or very close. Like this:


update: function() {

       graphics.lineTo(animated.X, animated.Y);



I figured it was a wrong approach, since it creates whole bunch of independent lines.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...