From b07e8d2baa70d6da287eaa555bc2bc5070c42c2f Mon Sep 17 00:00:00 2001 From: nathansmith117 Date: Mon, 3 Feb 2025 09:47:26 -0700 Subject: Really cool stuff --- test/scanTest1.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'test/scanTest1.c') diff --git a/test/scanTest1.c b/test/scanTest1.c index 06057f2..32c4d86 100644 --- a/test/scanTest1.c +++ b/test/scanTest1.c @@ -1,5 +1,7 @@ #include #include +#include +#include typedef struct Color { unsigned char r; @@ -10,6 +12,20 @@ typedef struct Color { Color lineScanner(uint16_t x, uint16_t y, uint32_t frameNumber) { - return (Color){.r = random() % 255, .g = random() % 255, .b = random() % 255, .a = 255}; + uint8_t c = 0; + + if (frameNumber % 255 >= 127) + { + c = (x >> 8) + (uint8_t)(hypot(x >> 9, y >> 9) * (frameNumber % 255)); + } else { + c = (x >> 8) + (uint8_t)(hypot(cos(x >> 9), sin(y >> 9)) * (frameNumber % 255)); + } + + return (Color){ + .r = (uint8_t)(sin(c) * 127), + .g = c - 127, + .b = c, + .a = 255 + }; } -- cgit v1.2.3