Page 1 of 1

Tint for LiveComposite?

Posted: Sat Feb 04, 2017 9:04 pm
by LabaroDD
Hello everyone!
I would like to apply matrix color to LiveComposite (I have an animated sprite here, lip-flapping and blinking). I want to use it for night/evening sceneries, but I can't find the way to make this... The solution is pretty simple, I guess, but I just can't realise how to do this ^^"

Any help will be appreciated!

Re: Tint for LiveComposite?

Posted: Tue Feb 07, 2017 3:36 am
by ISAWHIM
Try the ALPHABLEND() function...
I think you can create a "color" as an image, but I forgot the code for that... Not sure if it accepts "alpha" as one of the "colors"... But alphablend would work with an image.

It will not "colorize it", it will "tint" it, as a transparent overlay. (Thus, blacks will also gain the "color" of the tint.) However, if you have a tinted version of that image, with the shades, it will then blend perfectly, only tinting where you have the colors that exist in the overlay image, by a percentage.

Re: Tint for LiveComposite?

Posted: Tue Feb 07, 2017 4:15 am
by nyaatrap

Code: Select all

init python
    def ColorBlend(d, color="#000", alpha=.5):
        return AlphaBlend(Transform(d, alpha = alpha), d, Solid(color, xysize=(config.screen_width, config.screen_height)), alpha=True)

image darkend_sprite = ColorBlend(Image("sprite.png"))

Re: Tint for LiveComposite?

Posted: Tue Feb 07, 2017 5:51 am
by IrinaLazareva
or... (for LiveComposite)

Code: Select all

    image storm normal = LiveComposite((config.screen_width, config.screen_height),
        (0, 0), "image.png",
        )
    image storm night = LiveComposite((config.screen_width, config.screen_height),
        (0, 0), "image.png",
        (0, 0), "#0009",
        )
    image storm evening = LiveComposite((config.screen_width, config.screen_height),
        (0, 0), "image.png",
        (0, 0), "#0225",
        )
    image storm moning = LiveComposite((config.screen_width, config.screen_height),
        (0, 0), "image.png",
        (0, 0), "#7105",
        )

By the way, about alpha in hex code:
https://css-tricks.com/8-digit-hex-codes/

Re: Tint for LiveComposite?

Posted: Fri Feb 10, 2017 3:30 pm
by LabaroDD
Oh my! Thank you everyone! I'll try it all.