From a2140a4d04c86ef3a1a10fcb29a6d258c0df71b4 Mon Sep 17 00:00:00 2001 From: Bodmer Date: Thu, 27 Jan 2022 22:24:04 +0000 Subject: [PATCH] Add Gradient_Fill example --- .../Generic/Gradient_Fill/Gradient_Fill.ino | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 examples/Generic/Gradient_Fill/Gradient_Fill.ino diff --git a/examples/Generic/Gradient_Fill/Gradient_Fill.ino b/examples/Generic/Gradient_Fill/Gradient_Fill.ino new file mode 100644 index 0000000..84b619f --- /dev/null +++ b/examples/Generic/Gradient_Fill/Gradient_Fill.ino @@ -0,0 +1,38 @@ +/* + This sketch demonstrates the use of the horizontal and vertical gradient + rectangle fill functions. + + Example for library: + https://github.com/Bodmer/TFT_eSPI + + Created by Bodmer 27/1/22 +*/ + +#include // Include the graphics library +TFT_eSPI tft = TFT_eSPI(); // Create object "tft" + +// ------------------------------------------------------------------------- +// Setup +// ------------------------------------------------------------------------- +void setup(void) { + tft.init(); + tft.setRotation(1); + tft.fillScreen(TFT_DARKGREY); + tft.setTextFont(2); +} + +// ------------------------------------------------------------------------- +// Main loop +// ------------------------------------------------------------------------- +void loop() +{ + tft.fillRectHGradient(0, 0, 160, 50, TFT_MAGENTA, TFT_BLUE); + tft.setCursor(10,10); + tft.print("Horizontal gradient"); + + tft.fillRectVGradient(0, 60, 160, 50, TFT_ORANGE, TFT_RED); + tft.setCursor(10,70); + tft.print("Vertical gradient"); + + while(1) delay(100); // Wait here +}