From 4a7a3fd0089e12f4c8a9e15646a0157dde829674 Mon Sep 17 00:00:00 2001 From: Felix Pankratz Date: Sat, 7 Dec 2024 19:54:30 +0100 Subject: [PATCH] lookin okay --- organism/src/main.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/organism/src/main.cpp b/organism/src/main.cpp index f72484d..3fa5a83 100644 --- a/organism/src/main.cpp +++ b/organism/src/main.cpp @@ -41,7 +41,7 @@ int end_y = 27; int anchor_x = 16; int anchor_y = 24; -#define BLOB_POINTS 14 +#define BLOB_POINTS 32 #define BLOB_RADIUS 12 typedef struct { int x_coords[BLOB_POINTS]; @@ -65,7 +65,7 @@ void setup(){ mxconfig.i2sspeed = HUB75_I2S_CFG::HZ_10M; mxconfig.clkphase = false; - //mxconfig.double_buff = true; + mxconfig.double_buff = true; matrix = new MatrixPanel_I2S_DMA(mxconfig); matrix->begin(); @@ -92,7 +92,7 @@ void draw_bezier(int x1, int y1, int x2, int y2, int x3, int y3) { //matrix->drawLine(x1, y1, x2, y2, matrix->color565(16, 16, 16)); //matrix->drawLine(x2, y2, x3, y3, matrix->color565(16, 16, 16)); - for (float percent = 0; percent < 1; percent += 0.02) { + for (float percent = 0; percent < 1; percent += 0.01) { int xa = interpolate(x1, x2, percent); int ya = interpolate(y1, y2, percent); int xb = interpolate(x2, x3, percent); @@ -109,7 +109,7 @@ void draw_bezier(int x1, int y1, int x2, int y2, int x3, int y3) { void loop() { - // matrix ->flipDMABuffer(); + matrix ->flipDMABuffer(); //matrix->clearScreen(); matrix->fillScreenRGB888(15, 0, 10); // draw grid @@ -137,7 +137,15 @@ void loop() { blob.x_coords[end_offset], blob.y_coords[end_offset] ); - matrix->drawPixel(blob.x_coords[i], blob.y_coords[i], matrix->color565(128, 128, 128)); + //matrix->drawPixel(blob.x_coords[i], blob.y_coords[i], matrix->color565(128, 128, 128)); + blob.x_coords[i+1] += random(-1, 2); + if (blob.x_coords[i+1] >= PANEL_WIDTH) { + blob.x_coords[i+1] = PANEL_WIDTH - 1; + } + if (blob.x_coords[i+1] < 0) { + blob.x_coords[i+1] = 0; + } + //blob.y_coords[i+1] += random(-1, 2); //matrix->drawPixel(blob.x_coords[i], blob.y_coords[i], matrix->color565(0, 0, 128)); //matrix->drawPixel(blob.x_coords[i+1], blob.y_coords[i+1], matrix->color565(128, 0, 0)); //matrix->drawPixel(blob.x_coords[end_offset], blob.y_coords[end_offset], matrix->color565(0, 0, 128));