Jump to content

Clone and Edit linestyle in PixiV5


JosPixi
 Share

Recommended Posts

Hi,

I have created a shape with fill and line

Then i cloned and if i want to edit the linestyle in PIXIV5. its not working.
I referred this link https://www.html5gamedevs.com/topic/9374-change-the-style-of-line-that-is-already-drawn/ But i couldn't understand the issue in my case.

Here is my code.

independent_bet_shape = new PIXI.Graphics();
independent_bet_shape.lineStyle(2, 0xFF00FF, 1)

independent_bet_shape.beginFill(0xFFFFFF);
independent_bet_shape.moveTo(138,-125)
independent_bet_shape.lineTo(178,-125);
independent_bet_shape.lineTo(178,-145);
independent_bet_shape.lineTo(138,-145);
independent_bet_shape.endFill();

independent_highlight_shape = independent_bet_shape.clone()
independent_highlight_shape.x = independent_bet_shape.x
independent_highlight_shape.y = independent_bet_shape.y


Basically I need a working code, i understood the following points from other links.

* that Geometrical properties r not cloned,
* also we need to use dirty and clear dirty
* but graphics.geometry.invalidate() is not needed in pixi 5.

But the point is i dont complete with a working code.
 

 

Link to comment
Share on other sites

clone() doesnt clone geometry, so if you want different style - sorry, you have to do it from scratch. 

https://github.com/pixijs/pixi.js/blob/8f7ed7662949ea1217b6f3b6af470e855cfe0b13/packages/graphics/src/Graphics.ts#L262

if it worked, then graphics.geometry.invalidate() could help you, and it exists only in pixi-v5. I advice is to read source of functions that you use, it provides much more information than you could read from posts. I usually open separate IDE window on pixijs project and use shortcut to search for particular class.

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.

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

  • Recently Browsing   0 members

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