因项目用到WS2812彩灯,编灯光效果的时候发现很麻烦,而且用的数组(如下),很占空间(虽然空间足够),但如果增加减少效果很费劲。所以求助万能的坛子,有没有好用的一些算法或者软件编辑效果的。
另外,项目上的界面是这样的自定义效果,基于什么算法,一直搞不明白,比如那个混合颜色是什么鬼?
- /*********************************** 外圈花样定义 *************************************/
- const uint8_t rgbO_Mono[][3] = //r
- {{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- //r
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00}
- //g
- ,{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00}
- ,{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00}
- ,{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00}
- ,{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00}
- //g
- ,{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00}
- ,{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00}
- ,{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00}
- ,{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00}
- //b
- ,{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0x00}
- ,{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0x00}
- ,{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0x00}
- ,{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0x00}
- //b
- ,{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0xff}
- ,{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0xff}
- ,{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0xff}
- ,{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0xff}
- };
-
- const uint8_t rgbO_Move[][3] = //r6
- {{0xff,0x00,0x00},{0xf0,0x00,0x00},{0xe1,0x00,0x00},{0xd2,0x00,0x00}
- ,{0xc3,0x00,0x00},{0xb4,0x00,0x00},{0xa5,0x00,0x00},{0x96,0x00,0x00}
- ,{0x87,0x00,0x00},{0x78,0x00,0x00},{0x69,0x00,0x00},{0x5a,0x00,0x00}
- ,{0x4b,0x00,0x00},{0x3c,0x00,0x00},{0x2d,0x00,0x00},{0x1e,0x00,0x00}
-
- ,{0x00,0xff,0x00},{0x00,0xf0,0x00},{0x00,0xe1,0x00},{0x00,0xd2,0x00}
- ,{0x00,0xc3,0x00},{0x00,0xb4,0x00},{0x00,0xa5,0x00},{0x00,0x96,0x00}
- ,{0x00,0x87,0x00},{0x00,0x78,0x00},{0x00,0x69,0x00},{0x00,0x5a,0x00}
- ,{0x00,0x4b,0x00},{0x00,0x3c,0x00},{0x00,0x2d,0x00},{0x00,0x1e,0x00}
-
- ,{0x00,0x00,0xff},{0x00,0x00,0xf0},{0x00,0x00,0xe1},{0x00,0x00,0xd2}
- ,{0x00,0x00,0xc3},{0x00,0x00,0xb4},{0x00,0x00,0xa5},{0x00,0x00,0x96}
- ,{0x00,0x00,0x87},{0x00,0x00,0x78},{0x00,0x00,0x69},{0x00,0x00,0x5a}
- ,{0x00,0x00,0x4b},{0x00,0x00,0x3c},{0x00,0x00,0x2d},{0x00,0x00,0x1e}
- };
-
- /*********************************** 中间花样定义 *************************************/
- //数字0~9
- const uint8_t rgbM_Num[][3] = //0
- {{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- //1
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- //2
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- //3
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- //4
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- //5
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- //6
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- //7
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- //8
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- //9
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- };
- const uint8_t rgbM_Pattern1[][3] = //花样1 内向外扩散
- {{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x55,0x55,0x55},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- //
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x55,0x55,0x55},{0x55,0x55,0x55},{0x55,0x55,0x55},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x55,0x55,0x55},{0x00,0x00,0x00},{0x55,0x55,0x55},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x55,0x55,0x55},{0x55,0x55,0x55},{0x55,0x55,0x55},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- //
- ,{0x55,0x55,0x55},{0x55,0x55,0x55},{0x55,0x55,0x55},{0x55,0x55,0x55},{0x55,0x55,0x55}
- ,{0x55,0x55,0x55},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x55,0x55,0x55}
- ,{0x55,0x55,0x55},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x55,0x55,0x55}
- ,{0x55,0x55,0x55},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x55,0x55,0x55}
- ,{0x55,0x55,0x55},{0x55,0x55,0x55},{0x55,0x55,0x55},{0x55,0x55,0x55},{0x55,0x55,0x55}
- //r
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- //r
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- //r
- ,{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00}
- ,{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00}
- ,{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00}
- ,{0xff,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0xff,0x00,0x00}
- ,{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00},{0xff,0x00,0x00}
- //g
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- //g
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0xff,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0xff,0x00},{0x00,0xff,0x00},{0x00,0xff,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- //g
- ,{0x00,0xff,0x00},{0x00,0xff,0x00},{0x00,0xff,0x00},{0x00,0xff,0x00},{0x00,0xff,0x00}
- ,{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00}
- ,{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00}
- ,{0x00,0xff,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0xff,0x00}
- ,{0x00,0xff,0x00},{0x00,0xff,0x00},{0x00,0xff,0x00},{0x00,0xff,0x00},{0x00,0xff,0x00}
- //b
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- //b
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0xff},{0x00,0x00,0xff},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0xff},{0x00,0x00,0xff},{0x00,0x00,0xff},{0x00,0x00,0x00}
- ,{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}
- //b
- ,{0x00,0x00,0xff},{0x00,0x00,0xff},{0x00,0x00,0xff},{0x00,0x00,0xff},{0x00,0x00,0xff}
- ,{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0xff}
- ,{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0xff}
- ,{0x00,0x00,0xff},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0xff}
- ,{0x00,0x00,0xff},{0x00,0x00,0xff},{0x00,0x00,0xff},{0x00,0x00,0xff},{0x00,0x00,0xff}
- };
-
- /************************** 底层初始化 ******************************************/
复制代码 |