处理动画

This commit is contained in:
2026-02-09 04:07:32 +08:00
parent 85ed0946c8
commit 9822cf901d
5 changed files with 383 additions and 56 deletions

View File

@@ -14,10 +14,55 @@ var PRESET_COLORS = []struct {
{"黄色", 0xFF, 0xFF, 0x00},
{"橙色", 0xFF, 0xA5, 0x00},
{"紫色", 0x80, 0x00, 0x80},
{"自定义", 0x00, 0x00, 0x00},
//{"熄灭", 0x00, 0x00, 0x00},
}
// PRESET_MULTI_COLORS 预设颜色
var PRESET_MULTI_COLORS = []struct {
Name string
Color1 []byte
Color2 []byte
}{
// 霓虹紫蓝 (非常电竞范)
{"霓虹紫蓝",
[]byte{0xFF, 0x00, 0xFF}, // 紫色 (Magenta)
[]byte{0x00, 0xFF, 0xFF}, // 青蓝色 (Cyan)
},
// 冰火 (经典红蓝对比)
{"冰火",
[]byte{0xFF, 0x00, 0x00}, // 纯红
[]byte{0x00, 0x00, 0xFF}, // 纯蓝
},
// 赛博朋克 (经典配色)
{"赛博粉黄",
[]byte{0xFF, 0x00, 0x7F}, // 玫粉色
[]byte{0xFF, 0xD7, 0x00}, // 金黄色
},
// 森林气息 (柔和过渡)
{"森翠",
[]byte{0x00, 0xFF, 0x00}, // 绿色
[]byte{0x00, 0xFF, 0x7F}, // 春绿
},
// 晚霞 (暖色调)
{"晚霞",
[]byte{0xFF, 0x45, 0x00}, // 橙红
[]byte{0xFF, 0x14, 0x93}, // 深粉
},
// 黑客帝国 (极简)
{"矩阵",
[]byte{0x00, 0xFF, 0x00}, // 翠绿
[]byte{0x00, 0x33, 0x00}, // 暗绿 (深邃感)
},
//{"熄灭", 0x00, 0x00, 0x00},
}
// 雷蛇绿 (标志性的 Razer Green)
//razerGreen := []byte{0x00, 0xFF, 0x00} // 或者稍微深一点的 0x44, 0xFF, 0x00
@@ -85,16 +130,18 @@ func (rd *RazerDevice) SetOffLightsColor(color []byte) {
}
// SetBreathingColor 设置双色呼吸
func (rd *RazerDevice) SetBreathingColor() {
func (rd *RazerDevice) SetBreathingColor(subMode byte, rgb1 []byte, rgb2 []byte, speed byte) {
// 1. 定义呼吸子模式
subMode := byte(0x02) // 0x02 为双色切换呼吸
rgb1 := []byte{0xFF, 0x00, 0x00} // 颜色1: 红色
rgb2 := []byte{0x00, 0x00, 0xFF} // 颜色2: 蓝色
speed := byte(0x01) // 速度: 1(快) - 3(慢), 200可能过大建议先用1测试
//subMode := byte(0x02) // 0x02 为双色切换呼吸
//rgb1 := []byte{0xFF, 0x00, 0x00} // 颜色1: 红色
//rgb2 := []byte{0x00, 0x00, 0xFF} // 颜色2: 蓝色
//speed := byte(0x01) // 速度: 1(快) - 3(慢), 200可能过大建议先用1测试
//fmt.Println(subMode)
// 2. 构造参数包 (总长 8 字节)
// 结构: [SubMode, R1, G1, B1, R2, G2, B2, Speed]
breathingParams := append([]byte{subMode}, append(rgb1, append(rgb2, speed)...)...)
fmt.Println(breathingParams)
// 3. 调用新版 buildArguments (内部不再强制加 0x01)
args := buildArguments(KBD_EFFECT_BREATHING, KBD_BACKLIGHT_LED, breathingParams)