aboutsummaryrefslogtreecommitdiff
path: root/software/animation.ino
diff options
context:
space:
mode:
Diffstat (limited to 'software/animation.ino')
-rw-r--r--software/animation.ino18
1 files changed, 18 insertions, 0 deletions
diff --git a/software/animation.ino b/software/animation.ino
index 4c4976e..e59bfa1 100644
--- a/software/animation.ino
+++ b/software/animation.ino
@@ -9,3 +9,21 @@ unsigned int zigzag(unsigned int size, int index) {
unsigned int mod = index % zigzag_size;
return mod < size - 1 ? mod : zigzag_size - mod;
}
+
+void fill_plane(unsigned int direction, unsigned int offset) {
+ for(int i = 0; i < 16; i++) {
+ unsigned char axis1_offset = i / 4;
+ unsigned char axis2_offset = i % 4;
+
+ unsigned int axis1_weight = pow((direction + 1) % 3, 4);
+ unsigned int axis2_weight = pow((direction - 1) % 3, 4);
+ unsigned int axis3_weight = pow((direction ) % 3, 4);
+
+ led_state[
+ axis1_offset * axis1_weight +
+ axis2_offset * axis2_weight +
+ offset * axis3_weight
+ ] = 1;
+ }
+}
+