Jump to content

Is there any way to add/change fill color after creating Graphics?


rks
 Share

Recommended Posts

Hi, 

I am currently creating a polygon geometry with PIXI.Graphics. 

As one of the requirements of our application, we need to add fill color after we create a graphic. 

Is there any way to do it? 

Currently, we have something like below. 

const graphic = new PIXI.Graphics();
graphic.lineStyle(2, style.color, 1);
for (..){  
    if (type === 1) graphic.lineTo(x, y);
    else graphic.moveTo(x, y);
}

As you can see, this will simply create a polyline but we need to find a way to fill this polyline with some color and convert it to polygon. 
*this needs to be a polyline when it was created


It would be appreciating if you could give me any advise to achieve this. 

 

Link to comment
Share on other sites

Thanks for your reply. 

I just want users to have a way to edit the fill color and opacity of those graphics afterward. 

So probably destroying the existing graphics and creating new graphics with a new fill color would be the only way to enable those editings?

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