// ← back to all

diwali_burst

// diwali_burst · by 0x1306 · 8 frames · 83ms · festival
// views · runs
// preview
frame_00 / 08// 83ms per frame
// space: play/pause · ←→: step frames
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
#include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> // 0x1306.dev · animation: diwali_burst · 8 frames · 83ms #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 #define OLED_RESET -1 #define SCREEN_ADDRESS 0x3C Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); #define FRAME_COUNT 8 #define FRAME_DELAY 83 void drawFrame(int frame) { display.clearDisplay(); int cx = 64; int cy = 32; if (frame > 0) { int length = frame * 4 + 4; for (int i = 0; i < 12; i++) { float ang = (i * 30) * PI / 180.0; float x0 = cx + (length * 0.5) * cos(ang); float y0 = cy + (length * 0.5) * sin(ang); float x1 = cx + length * cos(ang); float y1 = cy + length * sin(ang); display.drawLine(x0, y0, x1, y1, WHITE); display.drawPixel(x1 + 2 * cos(ang), y1 + 2 * sin(ang), WHITE); // sparkle } } display.display(); } void setup() { Wire.begin(21, 22); // SDA=21, SCL=22 for ESP32 DevKit // change to 0x3D if display not found display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS); display.clearDisplay(); display.display(); } void loop() { for (int i = 0; i < FRAME_COUNT; i++) { drawFrame(i); delay(FRAME_DELAY); } }
// share
// embed
// paste into any html · 320×200 · transparent click opens detail page