New animation
This commit is contained in:
@@ -52,8 +52,6 @@ def gesc_pressed(key, state, KC, *args, **kwargs):
|
||||
|
||||
if GESC_TRIGGERS.intersection(state.keys_pressed):
|
||||
# First, release GUI if already pressed
|
||||
state.keys_pressed.discard(KC.LGUI)
|
||||
state.keys_pressed.discard(KC.RGUI)
|
||||
state.config._send_hid()
|
||||
# if Shift is held, KC_GRAVE will become KC_TILDE on OS level
|
||||
state.keys_pressed.add(KC.GRAVE)
|
||||
@@ -191,6 +189,12 @@ def rgb_mode_rainbow(key, state, *args, **kwargs):
|
||||
return state
|
||||
|
||||
|
||||
def rgb_mode_swirl(key, state, *args, **kwargs):
|
||||
state.config.pixels.effect_init = True
|
||||
state.config.pixels.animation_mode = 'swirl'
|
||||
return state
|
||||
|
||||
|
||||
def rgb_mode_knight(key, state, *args, **kwargs):
|
||||
state.config.pixels.effect_init = True
|
||||
state.config.pixels.animation_mode = 'knight'
|
||||
|
@@ -640,6 +640,7 @@ make_key(names=('RGB_MODE_BREATHE', 'RGB_M_B'), on_press=handlers.rgb_mode_breat
|
||||
make_key(names=('RGB_MODE_RAINBOW', 'RGB_M_R'), on_press=handlers.rgb_mode_rainbow)
|
||||
make_key(names=('RGB_MODE_BREATHE_RAINBOW', 'RGB_M_BR'),
|
||||
on_press=handlers.rgb_mode_breathe_rainbow)
|
||||
make_key(names=('RGB_MODE_SWIRL', 'RGB_M_S'), on_press=handlers.rgb_mode_swirl)
|
||||
make_key(names=('RGB_MODE_KNIGHT', 'RGB_M_K'), on_press=handlers.rgb_mode_knight)
|
||||
|
||||
|
||||
|
20
kmk/rgb.py
20
kmk/rgb.py
@@ -51,7 +51,7 @@ class RGB:
|
||||
self.knight_effect_length = knight_effect_length
|
||||
self.val_limit = val_limit
|
||||
self.rgb_animation_mode = animation_mode
|
||||
self.rgb_animation_speed = animation_speed
|
||||
self.animation_speed = animation_speed
|
||||
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
@@ -358,6 +358,8 @@ class RGB:
|
||||
return self.effect_static()
|
||||
elif self.animation_mode == 'knight':
|
||||
return self.effect_knight()
|
||||
elif self.animation_mode == 'swirl':
|
||||
return self.effect_swirl()
|
||||
elif self.animation_mode == 'static_standby':
|
||||
pass
|
||||
else:
|
||||
@@ -418,6 +420,22 @@ class RGB:
|
||||
|
||||
return self
|
||||
|
||||
def effect_swirl(self):
|
||||
if self._animation_step():
|
||||
self.increase_hue(self.animation_speed)
|
||||
self.disable_auto_write = True # Turn off instantly showing
|
||||
for i in range(0, self.num_pixels):
|
||||
self.set_hsv(
|
||||
(self.hue - (i * self.num_pixels)) % 360,
|
||||
self.sat,
|
||||
self.val,
|
||||
i)
|
||||
|
||||
# Show final results
|
||||
self.disable_auto_write = False # Resume showing changes
|
||||
self.show()
|
||||
return self
|
||||
|
||||
def effect_knight(self):
|
||||
# Determine which LEDs should be lit up
|
||||
self.disable_auto_write = True # Turn off instantly showing
|
||||
|
Reference in New Issue
Block a user