-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |