Flow direction of Rainbow Profile #182
-
Hello, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Yogomirius, the current rainbow script is lacking device topology information and does therefore not support custom rotation/orientation.
# This file is part of Eruption.
#
# Eruption is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Eruption is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eruption. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (c) 2019-2022, The Eruption Development Team
name = "Stock Gradient"
description = "Compute a gradient effect using a stock gradient or a custom color scheme"
version = "0.0.1"
author = "The Eruption Development Team"
min_supported_version = "0.2.0"
tags = ['Background', 'Vendor', 'Noise']
[[config]]
type = 'string'
name = 'stock_gradient'
description = 'The stock gradient or custom color scheme to use'
default = "sinebow-smooth"
[[config]]
type = 'bool'
name = 'horizontal'
description = 'Horizontal or vertical'
default = false
[[config]]
type = 'int'
name = 'direction'
description = '-1 == left/down, +1 == right/up'
default = 1
[[config]]
type = 'float'
name = 'wave_length'
description = 'Wave length divisor'
min = 0.01
max = 256.0
default = 5.0
[[config]]
type = 'float'
name = 'speed_divisor'
description = 'Speed of the wave'
min = 0.1
max = 1000.0
default = 64.0
[[config]]
type = 'float'
name = 'color_saturation'
description = 'Saturation in the range 0.0 .. 1.0'
min = 0.0
max = 1.0
default = 1.0
[[config]]
type = 'float'
name = 'color_lightness'
description = 'Lightness in the range 0.0 .. 0.5; above 0.5 == whiten color'
min = 0.0
max = 1.0
default = 0.5
[[config]]
type = 'float'
name = 'opacity'
description = 'Opacity value in the range 0.0 .. 1.0, where 1.0 is fully opaque'
min = 0.0
max = 1.0
default = 1.0
-- This file is part of Eruption.
--
-- Eruption is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- Eruption is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Eruption. If not, see <http://www.gnu.org/licenses/>.
--
-- Copyright (c) 2019-2022, The Eruption Development Team
--
require "declarations"
require "utilities"
require "debug"
-- global state variables --
ticks = 0
color_map = {}
grad = gradient_from_name(stock_gradient)
-- event handler functions --
function on_startup(config)
for i = 1, canvas_size do color_map[i] = 0xffffffff end
end
function on_tick(delta)
ticks = ticks + delta
-- calculate the gradient effect
if horizontal then
for i = num_cols, 0, -1 do
for j = 1, max_keys_per_col do
local val = sin(i / wave_length + (ticks * direction / speed_divisor))
local grad_pos = range(-1.0, 1.0, 0.0, 1.0, val)
local index = n(cols_topology[j + (i * max_keys_per_col)]) + 1
local color = gradient_color_at(grad, grad_pos)
-- finer grained color control
-- local h,s,l = color_to_hsl(color)
-- h = range(-120.0, 120.0, 0.0, 360.0, h)
-- color = hsla_to_color(h, (s * color_saturation) * 2, (l * color_lightness) * 2, 255)
color_map[index] = color
end
end
else
for i = num_rows, 0, -1 do
for j = 1, max_keys_per_row do
local val = sin(i / wave_length + (ticks * direction / speed_divisor))
local grad_pos = range(-1.0, 1.0, 0.0, 1.0, val)
local index = n(rows_topology[j + (i * max_keys_per_row)]) + 1
local color = gradient_color_at(grad, grad_pos)
-- finer grained color control
-- local h,s,l = color_to_hsl(color)
-- h = range(-120.0, 120.0, 0.0, 360.0, h)
-- color = hsla_to_color(h, (s * color_saturation) * 2, (l * color_lightness) * 2, 255)
color_map[index] = color
end
end
end
submit_color_map(color_map)
end
# This file is part of Eruption.
#
# Eruption is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Eruption is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eruption. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (c) 2019-2022, The Eruption Development Team
id = '5cd59fa6-e965-45cb-a0da-e87d29713123'
name = 'Rainbow Animation (vertical)'
description = 'Display an animated rainbow'
active_scripts = [
'stock-gradient.lua',
# 'halo.lua',
'shockwave.lua',
# 'impact.lua',
# 'water.lua',
# 'raindrops.lua',
# 'sysmon.lua',
'batique.lua',
# 'dim-zone.lua',
'macros.lua',
# 'stats.lua',
]
[[config."Stock Gradient"]]
type = 'string'
name = 'stock_gradient'
value = "sinebow-smooth"
default = "sinebow-smooth"
[[config."Stock Gradient"]]
type = 'bool'
name = 'horizontal'
value = false
default = false
[[config."Stock Gradient"]]
type = 'int'
name = 'direction'
value = 1
default = 1
[[config."Stock Gradient"]]
type = 'float'
name = 'wave_length'
value = 5.0
default = 5.0
[[config."Stock Gradient"]]
type = 'float'
name = 'speed_divisor'
value = 64.0
default = 64.0
[[config.Shockwave]]
type = 'color'
name = 'color_shockwave'
value = 0xffff5f00
default = 0xffff5f00
[[config.Shockwave]]
type = 'bool'
name = 'mouse_events'
value = true
default = true
[[config.Shockwave]]
type = 'color'
name = 'color_mouse_click_flash'
value = 0xa0ff0000
default = 0xa0ff0000
[[config.Shockwave]]
type = 'color'
name = 'color_mouse_wheel_flash'
value = 0xd0ff0000
default = 0xd0ff0000
[[config.Raindrops]]
type = 'float'
name = 'opacity'
value = 0.75
default = 0.75
[[config."System Monitor"]]
type = 'color'
name = 'color_cold'
value = 0x0000ff00
default = 0x0000ff00
[[config."System Monitor"]]
type = 'color'
name = 'color_hot'
value = 0xffff0000
default = 0xffff0000
# mouse support
[[config.Batique]]
type = 'int'
name = 'zone_start'
value = 144
default = 144
[[config.Batique]]
type = 'int'
name = 'zone_end'
value = 180
default = 180
[[config.Batique]]
type = 'float'
name = 'coord_scale'
value = 180
default = 180
# dim a specific zone, e.g. if the mouse LEDs are too bright
[[config."Dim Zone"]]
type = 'int'
name = 'zone_start'
value = 144
default = 144
[[config."Dim Zone"]]
type = 'int'
name = 'zone_end'
value = 180
default = 180
[[config."Dim Zone"]]
type = 'float'
name = 'opacity'
value = 1.0
default = 1.0 |
Beta Was this translation helpful? Give feedback.
Hi @Yogomirius,
the current rainbow script is lacking device topology information and does therefore not support custom rotation/orientation.
I wrote a new Lua script that supports orientation control, stock gradients and custom color schemes as well...
eruption/src/scripts/stock-gradient.lua.manifest