Skip to content

An M5Stack library for rendering avatar faces for CRT Display

License

Notifications You must be signed in to change notification settings

riraosan/m5stack-avatar-lgfx-cvbs

 
 

Repository files navigation

M5Stack-Avatar for CRT Display(Composite)

Powered By PlatformIO

Features

  • 😐 Draw avatar face
  • 😄 Expression(Happy, Angry, Sad etc.)
  • 😺 Customize face
  • 💋 Lip sync
  • 🎨 Color Palette
  • 🔃 Move, Zoom and Rotation
  • 2️⃣ Compatible with M5Stack Core2
  • Output to Composite Video Signal(CVBS)

Installation

Prerequisites

Using Arduino IDE

  • On Arduino IDE, Select "Sketch > Include Library > Manage Libraries..."
  • Search "m5stack avatar"
  • Select "M5Stack_Avatar" from the results then click "Install"
  • The library gets installed

Using Platform IO

  • Initialize your Platform IO project
mkdir my-avatar
cd my-avatar
platformio init -d . -b m5stack-core-esp32
  • Install the library and its dependency
platformio lib install M5Unified
platformio lib install M5Stack-Avatar-lgfx-cvbs
  • The library gets downloaded from repository to .piolibdeps directory

Usage

#include <M5GFX.h>
#include <LGFX_8BIT_CVBS.h>
#include <Avatar.h>

using namespace m5avatar;

static LGFX_8BIT_CVBS display;
static M5Canvas sp_avatar(&display);

Avatar avatar(&sp_avatar);

void setup()
{
  M5.begin();

  display.init();
  display.setPivot((display.width() >> 1), display.height() >> 1);

  avatar.init(1); // start drawing
  avatar.setScale(1.0);
  avatar.setRotation(0);
  avatar.setSpeechFont(&fonts::Font0);
  avatar.setSpeechText("Hello World!");
  avatar.setExpression(Expression::Happy);
}

void loop()
{
  // avatar's face updates in another thread
  // so no need to loop-by-loop rendering
}

Further usage

see examples directory.

About

An M5Stack library for rendering avatar faces for CRT Display

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.9%
  • Other 1.1%