Add colour mixer
This commit is contained in:
parent
97a82353a6
commit
2e9b5e5bc0
1 changed files with 27 additions and 1 deletions
|
|
@ -485,4 +485,30 @@ def make_animation(paths, options={}):
|
||||||
|
|
||||||
frames[0].save(os.path.join(options['save_folder'], options['save_filename']), format='GIF', append_images=frames[1:], save_all=True, duration=(1/options['fps'])*1000, loop=0)
|
frames[0].save(os.path.join(options['save_folder'], options['save_filename']), format='GIF', append_images=frames[1:], save_all=True, duration=(1/options['fps'])*1000, loop=0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def mix_colours(colour1, colour2, options):
|
||||||
|
|
||||||
|
default_options = {
|
||||||
|
'number_of_colours': 10,
|
||||||
|
'weights': None
|
||||||
|
}
|
||||||
|
|
||||||
|
options = aux.update_options(options=options, default_options=default_options)
|
||||||
|
|
||||||
|
if not options['weights']:
|
||||||
|
options['weights'] = [x/options['number_of_colours'] for x in range(options['number_of_colours'])]
|
||||||
|
|
||||||
|
colours = []
|
||||||
|
for weight in options['weights']:
|
||||||
|
colour = []
|
||||||
|
|
||||||
|
for c1, c2 in zip(colour1, colour2):
|
||||||
|
colour.append(np.round(((1-weight)*c1 + weight*c2), 5))
|
||||||
|
|
||||||
|
colours.append(colour)
|
||||||
|
|
||||||
|
|
||||||
|
return colours
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue