Jump to content

FillColor / FillAlpha Question


Ninjadoodle
 Share

Recommended Posts

Doesn't look like it. I think Graphics are bitmaps, rather than a list of drawing commands, so once it's created, changing what FillColor to use shouldn't affect anything unless you draw to the Graphic again. I haven't though of a way to do colour blending, yet, which I want to to make the particles prettier.

For alpha, just making sure you need FillAlpha, or you can just use .alpha?

 

Link to comment
Share on other sites

Sure you can. Graphics object has shapes array which contains all shapes that your object has. So for example if your Graphics object has only one shape, just change fillColor property of the first shape in the shapes array:

game.createScene('Main', {
    init: function() {
        this.grap = new game.Graphics();
        this.grap.drawRect(0, 0, 100, 50);
        this.grap.addTo(this.stage);
    },
    
    click: function() {
        this.grap.shapes[0].fillColor = 'red';
    }
});

 

5 hours ago, Wolfsbane said:

I think Graphics are bitmaps, rather than a list of drawing commands

Graphics is a list of drawing commands ;)

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