Eugenius

Change the style of line that is already drawn?

Recommended Posts

Shame on you, necro-ing very old thread. There were threads like that not long ago, its possible but requires full invalidation of p[ixi v5 graphics object. You have to manually change "graphics.geometry.graphicsData" and call "graphics.geometry.invalidate()" . Note, that all the performance problems wil be your fault. Use spectorJS to debug, separate multiple graphics into several instances e.t.c. i really cant put it all in one message, its a very big topic.

Share this post


Link to post
Share on other sites

@ivan.popelyshev i dont know what necro-ing is and i dont know why im getting insulted but im sure that this doesnt feel welcoming at all. If the issue is personal feel free to elaborate.

All i asked was a question. by the way i did justify that a so given solution wasnt really a solution here

Edited by CamO

Share this post


Link to post
Share on other sites

Necro-posting is making a comment to very old thread, its fine on stackoverflow, but on forums like that, when we switched 2 major versions of pixi after 2014, its better to create new one.

Oh, right, previous message was at 2019 year, not so necro.

so, why the answer in 

 isn't enough?

Share this post


Link to post
Share on other sites

Not really, unless I have missed something. Really all i am looking to do are 2 things:

 

1) when moving polygon point that the same goes for the lineStyle points dynamically (btw I am using vertexData to move change the points of the polygon)

2) to change the fill of the lineStyle when clicking on a button

Edited by CamO

Share this post


Link to post
Share on other sites

vertexData works only if graphics is small and it was detected as "batchable" (see the source of Graphics and GraphicsGeometry). You should change insides of `graphics.geometry.graphicsData` 

or something easy like that:

let myPoly = new Polygon(...);

graphics.drawPolygon(myPoly);

myPoly.points[0] = ... //change something

graphics.geometry.invalidate();

lineStyle gets copied so you cant just use it and  then change - you have to look inside `graphics.geometry.graphicsData[0]`. My earlier demo should work for you.

All those  problems are here because Graphics originally was created to be cleared&refilled.

Share this post


Link to post
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.

Guest
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.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.