// ← back to all

eyes_angry

// eyes_angry · by 0x1306 · 4 frames · 100ms · robot_eyes
// views · runs
// preview
frame_00 / 04// 100ms per frame
// space: play/pause · ←→: step frames
1234567891011121314151617181920212223242526272829303132333435363738
#include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> // 0x1306.dev · animation: eyes_angry · robot_eyes · 100ms #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 #define OLED_RESET -1 Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); void drawEyes(int lx, int ly, int lw, int lh, int lr, int rx, int ry, int rw, int rh, int rr) { display.fillRoundRect(lx - lw/2, ly - lh/2, lw, lh, lr, WHITE); display.fillRoundRect(rx - rw/2, ry - rh/2, rw, rh, rr, WHITE); } void drawFrame(int frame) { display.clearDisplay(); int th[] = {0, 6, 12, 6}; drawEyes(32, 32, 38, 28, 8, 96, 32, 38, 28, 8); if (th[frame] > 0) { display.fillRect(32, 32-14, 19, th[frame], BLACK); display.fillRect(96-19, 32-14, 19, th[frame], BLACK); } display.display(); } void setup() { Wire.begin(21, 22); display.begin(SSD1306_SWITCHCAPVCC, 0x3C); } void loop() { for (int i = 0; i < 4; i++) { drawFrame(i); delay(100); } }
// share
// embed
// paste into any html · 320×200 · transparent click opens detail page