organism #3

Merged
panki merged 17 commits from organism into master 2024-12-15 15:00:50 +01:00
Showing only changes of commit 4a7a3fd008 - Show all commits

View File

@ -41,7 +41,7 @@ int end_y = 27;
int anchor_x = 16; int anchor_x = 16;
int anchor_y = 24; int anchor_y = 24;
#define BLOB_POINTS 14 #define BLOB_POINTS 32
#define BLOB_RADIUS 12 #define BLOB_RADIUS 12
typedef struct { typedef struct {
int x_coords[BLOB_POINTS]; int x_coords[BLOB_POINTS];
@ -65,7 +65,7 @@ void setup(){
mxconfig.i2sspeed = HUB75_I2S_CFG::HZ_10M; mxconfig.i2sspeed = HUB75_I2S_CFG::HZ_10M;
mxconfig.clkphase = false; mxconfig.clkphase = false;
//mxconfig.double_buff = true; mxconfig.double_buff = true;
matrix = new MatrixPanel_I2S_DMA(mxconfig); matrix = new MatrixPanel_I2S_DMA(mxconfig);
matrix->begin(); 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(x1, y1, x2, y2, matrix->color565(16, 16, 16));
//matrix->drawLine(x2, y2, x3, y3, 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 xa = interpolate(x1, x2, percent);
int ya = interpolate(y1, y2, percent); int ya = interpolate(y1, y2, percent);
int xb = interpolate(x2, x3, 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() { void loop() {
// matrix ->flipDMABuffer(); matrix ->flipDMABuffer();
//matrix->clearScreen(); //matrix->clearScreen();
matrix->fillScreenRGB888(15, 0, 10); matrix->fillScreenRGB888(15, 0, 10);
// draw grid // draw grid
@ -137,7 +137,15 @@ void loop() {
blob.x_coords[end_offset], blob.x_coords[end_offset],
blob.y_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], 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[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)); //matrix->drawPixel(blob.x_coords[end_offset], blob.y_coords[end_offset], matrix->color565(0, 0, 128));