Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

10 years ago by Rungo73

Hi

Can anyone explain how to use composite blend modes
on entities ?

In particular I'm interested in replicating the additive glow
effect @Dominic used on his bullets I'm z-type.

Cheers,
Tom

10 years ago by drhayes

Start with the documentation on the canvas context. It's available in Impact via ig.system.context.

You're probably most interested in globalCompositeOperation, specifically.

This thread is a good resource, too.

Here's Dom's blog post talking about how he got the glow effect to work.

HTH. ( =

10 years ago by Rungo73

Cheers for the response.

I was on the right path with the globalCompositeOperation but just not sure
how to apply that to a single entity ie an explosion, or glowing bullet.

Will dig around the links you've provided - much appreciated.

10 years ago by Joncom

Quote from Rungo73
....not sure how to apply that to a single entity
I believe it'd look something like this:

/* some-entity.js */
draw: function() {

    // Save state of context because we'll need to restore it later.
    ig.system.context.save();

    // Specify effect.
    ig.system.context.globalCompositeOperation = 'lighter';

    // Draw
    this.parent();

    // Restore context so effect doesn't carry into other draws.
    ig.system.context.restore();
}

10 years ago by Rungo73

Yes!!

Thank you that's exactly what I was looking for!
Page 1 of 1
« first « previous next › last »