diff --git a/rgbanimations/vialrgbCycleAll.go b/rgbanimations/vialrgbCycleAll.go new file mode 100644 index 0000000..f5cce2b --- /dev/null +++ b/rgbanimations/vialrgbCycleAll.go @@ -0,0 +1,18 @@ +package rgbanimations + +import keyboard "github.com/percyjw-2/tinygo-keyboard" + +func GetCycleAllAnim() keyboard.RgbAnimation { + return keyboard.RgbAnimation{ + AnimationFunc: vialRGBCycleAll, + AnimationType: keyboard.VIALRGB_EFFECT_CYCLE_ALL, + } +} + +func cycleAllMath(matrix *keyboard.RGBMatrix, i int, time uint16) (uint8, uint8, uint8) { + return uint8(time), matrix.CurrentSaturation, matrix.CurrentValue +} + +func vialRGBCycleAll(matrix *keyboard.RGBMatrix) { + effectRunnerI(matrix, cycleAllMath) +} diff --git a/rgbanimations/vialrgbCycleLeftRight.go b/rgbanimations/vialrgbCycleLeftRight.go new file mode 100644 index 0000000..05359e5 --- /dev/null +++ b/rgbanimations/vialrgbCycleLeftRight.go @@ -0,0 +1,19 @@ +package rgbanimations + +import keyboard "github.com/percyjw-2/tinygo-keyboard" + +func GetCycleLeftRightAnim() keyboard.RgbAnimation { + return keyboard.RgbAnimation{ + AnimationFunc: vialRGBCycleLeftRight, + AnimationType: keyboard.VIALRGB_EFFECT_CYCLE_LEFT_RIGHT, + } +} + +func cycleLeftRightMath(matrix *keyboard.RGBMatrix, i int, time uint16) (uint8, uint8, uint8) { + h := matrix.LedMatrixMapping[i].PhysicalX - uint8(time) + return h, matrix.CurrentSaturation, matrix.CurrentValue +} + +func vialRGBCycleLeftRight(matrix *keyboard.RGBMatrix) { + effectRunnerI(matrix, cycleLeftRightMath) +} diff --git a/rgbanimations/vialrgbCycleOutIn.go b/rgbanimations/vialrgbCycleOutIn.go new file mode 100644 index 0000000..e52bf3e --- /dev/null +++ b/rgbanimations/vialrgbCycleOutIn.go @@ -0,0 +1,19 @@ +package rgbanimations + +import keyboard "github.com/percyjw-2/tinygo-keyboard" + +func GetCycleOutInAnim() keyboard.RgbAnimation { + return keyboard.RgbAnimation{ + AnimationFunc: vialRGBCycleOutIn, + AnimationType: keyboard.VIALRGB_EFFECT_CYCLE_OUT_IN, + } +} + +func cycleOutInMath(matrix *keyboard.RGBMatrix, _ int16, _ int16, dist uint8, time uint16) (uint8, uint8, uint8) { + h := 3*dist/2 + uint8(time) + return h, matrix.CurrentSaturation, matrix.CurrentValue +} + +func vialRGBCycleOutIn(matrix *keyboard.RGBMatrix) { + effectRunnerDXDYDist(matrix, cycleOutInMath) +} diff --git a/rgbanimations/vialrgbCycleOutInDual.go b/rgbanimations/vialrgbCycleOutInDual.go new file mode 100644 index 0000000..63be74d --- /dev/null +++ b/rgbanimations/vialrgbCycleOutInDual.go @@ -0,0 +1,21 @@ +package rgbanimations + +import keyboard "github.com/percyjw-2/tinygo-keyboard" + +func GetCycleOutInDualAnim() keyboard.RgbAnimation { + return keyboard.RgbAnimation{ + AnimationFunc: vialRGBCycleOutInDual, + AnimationType: keyboard.VIALRGB_EFFECT_CYCLE_OUT_IN_DUAL, + } +} + +func cycleOutInDualMath(matrix *keyboard.RGBMatrix, dx int16, dy int16, time uint16) (uint8, uint8, uint8) { + dx = int16(matrix.CenterXPhysical/2) - Abs16(dx) + dist := Sqrt16(uint16(dx*dx) + uint16(dy*dy)) + h := 3*dist + uint8(time) + return h, matrix.CurrentSaturation, matrix.CurrentValue +} + +func vialRGBCycleOutInDual(matrix *keyboard.RGBMatrix) { + effectRunnerDXDY(matrix, cycleOutInDualMath) +} diff --git a/rgbanimations/vialrgbCyclePinwheel.go b/rgbanimations/vialrgbCyclePinwheel.go new file mode 100644 index 0000000..f46f4f4 --- /dev/null +++ b/rgbanimations/vialrgbCyclePinwheel.go @@ -0,0 +1,19 @@ +package rgbanimations + +import keyboard "github.com/percyjw-2/tinygo-keyboard" + +func GetCyclePinwheelAnim() keyboard.RgbAnimation { + return keyboard.RgbAnimation{ + AnimationFunc: vialRGBCyclePinwheel, + AnimationType: keyboard.VIALRGB_EFFECT_CYCLE_PINWHEEL, + } +} + +func cyclePinwheelMath(matrix *keyboard.RGBMatrix, dx int16, dy int16, time uint16) (uint8, uint8, uint8) { + h := Atan28(dy, dx) + uint8(time) + return h, matrix.CurrentSaturation, matrix.CurrentValue +} + +func vialRGBCyclePinwheel(matrix *keyboard.RGBMatrix) { + effectRunnerDXDY(matrix, cyclePinwheelMath) +} diff --git a/rgbanimations/vialrgbCycleSpiral.go b/rgbanimations/vialrgbCycleSpiral.go new file mode 100644 index 0000000..3fd0294 --- /dev/null +++ b/rgbanimations/vialrgbCycleSpiral.go @@ -0,0 +1,19 @@ +package rgbanimations + +import keyboard "github.com/percyjw-2/tinygo-keyboard" + +func GetCycleSpiralAnim() keyboard.RgbAnimation { + return keyboard.RgbAnimation{ + AnimationFunc: vialRGBCycleSpiral, + AnimationType: keyboard.VIALRGB_EFFECT_CYCLE_SPIRAL, + } +} + +func cycleSpiralMath(matrix *keyboard.RGBMatrix, dx int16, dy int16, dist uint8, time uint16) (uint8, uint8, uint8) { + h := dist - uint8(time) - Atan28(dy, dx) + return h, matrix.CurrentSaturation, matrix.CurrentValue +} + +func vialRGBCycleSpiral(matrix *keyboard.RGBMatrix) { + effectRunnerDXDYDist(matrix, cycleSpiralMath) +} diff --git a/rgbanimations/vialrgbCycleUpDown.go b/rgbanimations/vialrgbCycleUpDown.go new file mode 100644 index 0000000..7bf24de --- /dev/null +++ b/rgbanimations/vialrgbCycleUpDown.go @@ -0,0 +1,19 @@ +package rgbanimations + +import keyboard "github.com/percyjw-2/tinygo-keyboard" + +func GetCycleUpDownAnim() keyboard.RgbAnimation { + return keyboard.RgbAnimation{ + AnimationFunc: vialRGBCycleUpDown, + AnimationType: keyboard.VIALRGB_EFFECT_CYCLE_UP_DOWN, + } +} + +func cycleUpDownMath(matrix *keyboard.RGBMatrix, i int, time uint16) (uint8, uint8, uint8) { + h := matrix.LedMatrixMapping[i].PhysicalY - uint8(time) + return h, matrix.CurrentSaturation, matrix.CurrentValue +} + +func vialRGBCycleUpDown(matrix *keyboard.RGBMatrix) { + effectRunnerI(matrix, cycleUpDownMath) +} diff --git a/rgbanimations/vialrgbRainbowMovingChevron.go b/rgbanimations/vialrgbRainbowMovingChevron.go new file mode 100644 index 0000000..2845737 --- /dev/null +++ b/rgbanimations/vialrgbRainbowMovingChevron.go @@ -0,0 +1,19 @@ +package rgbanimations + +import keyboard "github.com/percyjw-2/tinygo-keyboard" + +func GetRainbowMovingChevronAnim() keyboard.RgbAnimation { + return keyboard.RgbAnimation{ + AnimationFunc: vialRGBRainbowMovingChevron, + AnimationType: keyboard.VIALRGB_EFFECT_RAINBOW_MOVING_CHEVRON, + } +} + +func rainbowMovingChevronMath(matrix *keyboard.RGBMatrix, i int, time uint16) (uint8, uint8, uint8) { + h := matrix.CurrentHue + Abs8(int8(matrix.LedMatrixMapping[i].PhysicalY-matrix.CenterYPhysical)+int8(matrix.CenterXPhysical-uint8(time))) + return h, matrix.CurrentSaturation, matrix.CurrentValue +} + +func vialRGBRainbowMovingChevron(matrix *keyboard.RGBMatrix) { + effectRunnerI(matrix, rainbowMovingChevronMath) +}