3#include "../Animation.h" 
    4#include "../KeyFrameTrack.h" 
    5#include "../EasyEaseAnimator.h" 
    6#include "../../Objects/Background.h" 
    7#include "../../Morph/MyntFace.h" 
    8#include "../../Morph/MyntFood.h" 
    9#include "../../Morph/MyntPacman.h" 
   10#include "../../Morph/MyntSOS.h" 
   11#include "../../Morph/MyntZZZ.h" 
   12#include "../../Render/Scene.h" 
   13#include "../../Signals/FunctionGenerator.h" 
   14#include "../../Sensors/MenuButtonHandler.h" 
   15#include "../../Sensors/BoopSensor.h" 
   16#include "../../Sensors/MicrophoneFourier_MAX9814.h" 
   18#include "../../Materials/Animated/SpectrumAnalyzer.h" 
   19#include "../../Materials/Animated/RainbowNoise.h" 
   20#include "../../Materials/Animated/RainbowSpiral.h" 
   22#include "../../Materials/CombineMaterial.h" 
   24#include "../AnimationTracks/BlinkTrack.h" 
   26#include "../../Signals/FFTVoiceDetection.h" 
   82        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::EyesAngry), MyntFace::EyesAngry, 60, 0.0f, 1.0f);
 
   83        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::EyesDead), MyntFace::EyesDead, 60, 0.0f, 1.0f);
 
   84        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::EyesHappy), MyntFace::EyesHappy, 60, 0.0f, 1.0f);
 
   85        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::EyesHeart), MyntFace::EyesHeart, 60, 0.0f, 1.0f);
 
   86        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::EyesHeartB), MyntFace::EyesHeartB, 60, 0.0f, 1.0f);
 
   87        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::EyesClosed), MyntFace::EyesClosed, 60, 0.0f, 1.0f);
 
   88        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::HideEyes), MyntFace::HideEyes, 60, 0.0f, 1.0f);
 
   90        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::HideNose), MyntFace::HideNose, 60, 0.0f, 1.0f);
 
   92        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::MouthAngry), MyntFace::MouthAngry, 60, 0.0f, 1.0f);
 
   93        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::MouthDead), MyntFace::MouthDead, 60, 0.0f, 1.0f);
 
   94        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::MouthHappy), MyntFace::MouthHappy, 60, 0.0f, 1.0f);
 
   95        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::MouthLove), MyntFace::MouthLove, 60, 0.0f, 1.0f);
 
   96        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::MouthSleepy), MyntFace::MouthSleepy, 60, 0.0f, 1.0f);
 
   97        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::HideMouth), MyntFace::HideMouth, 60, 0.0f, 1.0f);
 
   98        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::MouthTalk), MyntFace::MouthTalk, 2, 0.0f, 1.0f);
 
   99        eEA.
AddParameter(
pM.GetMorphWeightReference(MyntFace::MouthTalk2), MyntFace::MouthTalk2, 2, 0.0f, 1.0f);
 
 
  138        scene.AddObject(
pM.GetObject());
 
  141        scene.AddObject(
pacman.GetObject());
 
  142        scene.AddObject(
sos.GetObject());
 
  143        scene.AddObject(
zzz.GetObject());
 
  159        MenuButtonHandler::Initialize(0, 9, 1000);
 
 
  208        zzz.GetObject()->Enable();
 
 
  223        sos.GetObject()->Enable();
 
 
  236        pacman.GetObject()->Enable();
 
 
  252        pM.GetObject()->Disable();
 
 
  263        return pM.GetObject();
 
 
  267        if(MenuButtonHandler::UseMicrophone() && 
talk){
 
  269            float mouthForward = 0.0f;
 
 
  290        pM.GetObject()->Enable();
 
  293        pacman.GetObject()->Disable();
 
  294        sos.GetObject()->Disable();
 
  295        zzz.GetObject()->Disable();
 
  301        bool isBooped = MenuButtonHandler::UseBoopSensor() ? 
boop.isBooped() : 0;
 
  302        uint8_t mode = MenuButtonHandler::GetFaceState();
 
  310        if (isBooped && mode != 6){
 
  315            else if (mode == 1) 
Dead();
 
  316            else if (mode == 2) 
Happy();
 
  317            else if (mode == 3) 
Love();
 
  318            else if (mode == 4) 
Sleepy();
 
  328        pM.SetMorphWeight(MyntFace::IncreaseSize, 1.0f);
 
  348            pM.GetObject()->GetTransform()->SetPosition(
Vector3D(0, -1000.0f, 600.0f));
 
  351            pM.GetObject()->GetTransform()->SetPosition(
Vector3D(x, y, 600.0f));
 
  354        pM.GetObject()->GetTransform()->SetRotation(
Vector3D(0.0f, 0.0f, 0.0f));
 
  355        pM.GetObject()->GetTransform()->SetScale(
Vector3D(1.0f, 1.0f, 1.0f));
 
  356        pM.GetObject()->UpdateTransform();
 
  359        float pacmanPos = 400.0f * (0.5f - ratio);
 
  360        int pacmanFoodPos = pacmanPos < 0 ? (int(pacmanPos) / 25) * 25 : -(int(pacmanPos) / 25) * 50;
 
  364        pacmanFood.GetObject()->GetTransform()->SetPosition(
Vector3D(x + pacmanFoodPos, y, 700.0f));
 
  365        pacmanFood.GetObject()->GetTransform()->SetScale(
Vector3D(scalePacman, scalePacman, scalePacman));
 
  366        pacmanFood.GetObject()->GetTransform()->SetScaleOffset(pCenter);
 
  369        pacman.GetObject()->GetTransform()->SetRotation(
Vector3D(0.0f, 0.0f, 0.0f));
 
  370        pacman.GetObject()->GetTransform()->SetPosition(
Vector3D(x + pacmanPos, y, 600.0f));
 
  371        pacman.GetObject()->GetTransform()->SetScale(
Vector3D(scalePacman, scalePacman, scalePacman));
 
  372        pacman.GetObject()->GetTransform()->SetScaleOffset(pCenter);
 
  373        pacman.GetObject()->UpdateTransform();
 
  376        float scaleSOS = 0.5f + scaleAnim / 2.0f;
 
  378        Vector3D sosCenter = 
sos.GetObject()->GetCenterOffset();
 
  379        sos.GetObject()->GetTransform()->SetRotation(
Vector3D(0.0f, ratio * 360.0f, 0.0f));
 
  380        sos.GetObject()->GetTransform()->SetRotationOffset(sosCenter);
 
  381        sos.GetObject()->GetTransform()->SetPosition(
Vector3D(x - 5.0f, y - 15.0f, 600.0f));
 
  382        sos.GetObject()->GetTransform()->SetScale(
Vector3D(scaleSOS, scaleSOS, scaleSOS));
 
  383        sos.GetObject()->GetTransform()->SetScaleOffset(sosCenter);
 
  384        sos.GetObject()->UpdateTransform();
 
  386        float scaleZZZ = 0.9f + scaleAnim / 5.0f;
 
  388        Vector3D zzzCenter = 
zzz.GetObject()->GetCenterOffset();
 
  389        zzz.GetObject()->GetTransform()->SetRotation(
Vector3D(0.0f, ratio * 360.0f, 0.0f));
 
  390        zzz.GetObject()->GetTransform()->SetRotationOffset(zzzCenter);
 
  391        zzz.GetObject()->GetTransform()->SetPosition(
Vector3D(x - 15.0f, y - 15.0f, 600.0f));
 
  392        zzz.GetObject()->GetTransform()->SetScale(
Vector3D(scaleZZZ, scaleZZZ, scaleZZZ));
 
  393        zzz.GetObject()->GetTransform()->SetScaleOffset(zzzCenter);
 
  394        zzz.GetObject()->UpdateTransform();
 
 
 
void AddParameter(float *parameter)
Adds a parameter to the animation track.
 
void Play()
Starts or resumes playback of the animation track.
 
void Pause()
Pauses playback of the animation track.
 
float Update()
Updates the animation track and returns the current parameter value.
 
A template class for animating eye blinking using keyframes.
 
Combines multiple materials with specified blending methods and opacities.
 
void SetOpacity(uint8_t index, float opacity)
Sets the opacity for a specific material.
 
void AddMaterial(Method method, Material *material, float opacity)
Adds a new material to the combination.
 
A template class for implementing advanced animation easing.
 
void AddParameterFrame(uint16_t dictionaryValue, float value) override
Adds a single frame value for a parameter.
 
void Update() override
Updates the animator, advancing all animations.
 
void SetInterpolationMethod(uint16_t dictionaryValue, InterpolationMethod interpMethod) override
Sets the interpolation method for a specific parameter.
 
void AddParameter(float *parameter, uint16_t dictionaryValue, uint16_t frames, float basis, float goal) override
Adds a parameter to the animator.
 
Detects visemes based on FFT voice analysis.
 
float GetViseme(MouthShape viseme)
Retrieves the probability of a specific viseme.
 
void Update(float *peaks, float maxFrequency)
Updates the viseme probabilities based on new FFT data.
 
A class to generate various waveform functions with customizable parameters.
 
float Update()
Updates and calculates the next value of the waveform.
 
@ Lighten
Chooses the lighter color.
 
@ Add
Adds colors together.
 
@ Replace
Replaces the base color.
 
static T Constrain(T value, T minimum, T maximum)
Constrains a value between minimum and maximum.
 
static float GetCurrentMagnitude()
Retrieves the current signal magnitude.
 
static float GetSampleRate()
Retrieves the current sampling rate.
 
static float * GetFourierFiltered()
Retrieves the filtered FFT output data.
 
static void Initialize(uint8_t pin, uint32_t sampleRate, float minDB, float maxDB)
Initializes the microphone and FFT system with basic parameters.
 
static void Update()
Updates the microphone system, processing new samples and performing FFT.
 
SimpleMaterial greenMaterial
 
FunctionGenerator fGenMatYMove
 
SimpleMaterial pinkMaterial
 
SimpleMaterial redMaterial
 
SimpleMaterial tealMaterial
 
void UpdateKeyFrameTracks()
 
FunctionGenerator fGenMatPacman
 
SimpleMaterial blueMaterial
 
CombineMaterial< 5 > faceMaterial
 
FunctionGenerator fGenMatScalePacman
 
SimpleMaterial yellowMaterial
 
void ChangeInterpolationMethods()
 
void SpectrumAnalyzerFace()
 
FunctionGenerator fGenMatPos
 
FunctionGenerator fGenScale
 
FunctionGenerator fGenRotation
 
EasyEaseAnimator< 30 > eEA
 
void FadeIn(float stepRatio) override
 
void FadeOut(float stepRatio) override
 
RainbowNoise rainbowNoise
 
FunctionGenerator fGenMatXMove
 
void Update(float ratio) override
 
FFTVoiceDetection< 128 > voiceDetection
 
FunctionGenerator fGenMatScaleAnim
 
Represents a 3D object with geometry, material, and transformation data.
 
Represents an RGB color and provides methods for manipulation.
 
A dynamic material that creates a rainbow effect using simplex noise.
 
void Update(float ratio)
Updates the material animation based on the time ratio.
 
A material that applies a single, solid RGB color to surfaces.
 
A material that visualizes audio data as a spectrum.
 
void SetMirrorYState(bool state)
Sets the mirroring state for the visualization.
 
void Update(float *readData)
Updates the spectrum visualization with new audio data.
 
void SetFlipYState(bool state)
Sets the flipping state for the visualization.
 
void SetHueAngle(float hueAngle)
Sets the hue adjustment angle for the spectrum colors.
 
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
 
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
 
@ ER
Mouth shape corresponding to the "ER" sound.
 
@ OO
Mouth shape corresponding to the "OO" sound.
 
@ AH
Mouth shape corresponding to the "AH" sound.
 
@ UH
Mouth shape corresponding to the "UH" sound.
 
@ AR
Mouth shape corresponding to the "AR" sound.
 
@ EE
Mouth shape corresponding to the "EE" sound.