merge_colour

Merges two colours by a given amount.

Syntax:

merge_colour(col1, col2, amount);


Argument Description
col1 The first colour to merge
col2 The second colour to merge
amount How much of each colour should be merged. For example, 0 will return col1, 1 will return col2, and 0.5 would return a merge of both colours equally


Returns: value


Description

With this function you can take two colours and then merge them together to make a new colour. The amount of each of the component colours can be defined by changing the "amount" argument, where a value of 0 will return the first colour (col1), a value of 1 will return the second colour (col2) and a value in between will return the corresponding mix. For example, a value of 0.5 will mix the two colours equally. The following image illustrates how this works by merging the colours red and blue together:


Example:

col = merge_colour(c_lime, c_orange, 0.5);

The above code uses the function to create a colour by merging lime and orange 50/50 and then stores its value in the variable "col" for later use.


Back: colour and Blending
Next: make_colour_hsv
© Copyright YoYo Games Ltd. 2018 All Rights Reserved