acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

Gradient_Fill.ino (1051B)

      1 /*
      2   This sketch demonstrates the use of the horizontal and vertical gradient
      3   rectangle fill functions.
      4 
      5   Example for library:
      6   https://github.com/Bodmer/TFT_eSPI
      7 
      8   Created by Bodmer 27/1/22
      9 */
     10 
     11 #include <TFT_eSPI.h>       // Include the graphics library
     12 TFT_eSPI tft = TFT_eSPI();  // Create object "tft"
     13 
     14 // -------------------------------------------------------------------------
     15 // Setup
     16 // -------------------------------------------------------------------------
     17 void setup(void) {
     18   tft.init();
     19   tft.setRotation(1);
     20   tft.fillScreen(TFT_DARKGREY);
     21   tft.setTextFont(2);
     22 }
     23 
     24 // -------------------------------------------------------------------------
     25 // Main loop
     26 // -------------------------------------------------------------------------
     27 void loop()
     28 {
     29   tft.fillRectHGradient(0, 0, 160, 50, TFT_MAGENTA, TFT_BLUE);
     30   tft.setCursor(10,10);
     31   tft.print("Horizontal gradient");
     32 
     33   tft.fillRectVGradient(0, 60, 160, 50, TFT_ORANGE, TFT_RED);
     34   tft.setCursor(10,70);
     35   tft.print("Vertical gradient");
     36 
     37   while(1) delay(100); // Wait here
     38 }