3#include "../Animation.h"
4#include "../KeyFrameTrack.h"
5#include "../EasyEaseAnimator.h"
6#include "../../Objects/Background.h"
7#include "../../Objects/LEDStripBackground.h"
8#include "../../Morph/Commissions/BroookFace.h"
9#include "../../Morph/Commissions/BroookExtras.h"
10#include "../../Render/Scene.h"
11#include "../../Signals/FunctionGenerator.h"
12#include "../../Menu/SingleButtonMenu.h"
13#include "../../Sensors/APDS9960.h"
15#include "../../Materials/Animated/RainbowNoise.h"
16#include "../../Materials/Animated/RainbowSpiral.h"
17#include "../../Materials/Animated/SpectrumAnalyzer.h"
18#include "../../Materials/Animated/AudioReactiveGradient.h"
19#include "../../Materials/Animated/Oscilloscope.h"
21#include "../../Materials/MaterialAnimator.h"
23#include "../AnimationTracks/BlinkTrack.h"
25#include "../../Signals/FFTVoiceDetection.h"
27#include "../../Sensors/MicrophoneFourier_MAX9814.h"
29#include "../../Render/ObjectAlign.h"
31#include "Flash/ImageSequences/BadApple.h"
97 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::Determined2), BroookFace::Determined2, 15, 0.0f, 1.0f);
98 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::Upset3), BroookFace::Upset3, 15, 0.0f, 1.0f);
99 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::Sleepy4), BroookFace::Sleepy4, 50, 0.0f, 1.0f);
100 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::Sad5), BroookFace::Sad5, 50, 0.0f, 1.0f);
101 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::Happy6), BroookFace::Happy6, 15, 0.0f, 1.0f);
102 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::Flustered7), BroookFace::Flustered7, 45, 0.0f, 1.0f);
103 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::Dot8), BroookFace::Dot8, 30, 0.0f, 1.0f);
104 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::Heart9), BroookFace::Heart9, 30, 0.0f, 1.0f);
105 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::Dead10), BroookFace::Dead10, 30, 0.0f, 1.0f);
106 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::Question11), BroookFace::Question11, 30, 0.0f, 1.0f);
108 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::vrc_v_ee), BroookFace::vrc_v_ee, 2, 0.0f, 1.0f);
109 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::vrc_v_aa), BroookFace::vrc_v_aa, 2, 0.0f, 1.0f);
110 eEA.
AddParameter(
pM.GetMorphWeightReference(BroookFace::vrc_v_oh), BroookFace::vrc_v_oh, 2, 0.0f, 1.0f);
112 eEA.
AddParameter(
pME.GetMorphWeightReference(BroookExtras::Heart), BroookExtras::Heart + 100, 30, 0.0f, 1.0f);
113 eEA.
AddParameter(
pME.GetMorphWeightReference(BroookExtras::Dead), BroookExtras::Dead + 100, 30, 0.0f, 1.0f);
114 eEA.
AddParameter(
pME.GetMorphWeightReference(BroookExtras::Sleepy), BroookExtras::Sleepy + 100, 50, 0.0f, 1.0f);
115 eEA.
AddParameter(
pME.GetMorphWeightReference(BroookExtras::Happy), BroookExtras::Happy + 100, 15, 0.0f, 1.0f);
116 eEA.
AddParameter(
pME.GetMorphWeightReference(BroookExtras::Sad), BroookExtras::Sad + 100, 50, 0.0f, 1.0f);
117 eEA.
AddParameter(
pME.GetMorphWeightReference(BroookExtras::None), BroookExtras::None + 100, 30, 0.0f, 1.0f);
283 if(MicrophoneFourierIT::GetCurrentMagnitude() > 0.05f){
284 voiceDetection.
Update(MicrophoneFourierIT::GetFourierFiltered(), MicrophoneFourierIT::GetSampleRate());
314 scene.AddObject(
pM.GetObject());
315 scene.AddObject(
pME.GetObject());
341 MicrophoneFourierIT::Initialize(A0, 8000, 50.0f, 120.0f);
357 return pM.GetObject();
374 MicrophoneFourierIT::Update();
380 aRG.
SetSize(
Vector2D((xOffset + 2.0f) * 10.0f + 50.0f, (xOffset + 2.0f) * 10.0f + 50.0f));
404 else if (mode == 2)
Upset();
405 else if (mode == 3)
Sleepy();
406 else if (mode == 4)
Sad();
408 else if (mode == 6)
Dot();
409 else if (mode == 7)
Heart();
410 else if (mode == 8)
Dead();
412 else if (mode == 10) {
413 aRG.
Update(MicrophoneFourierIT::GetFourierFiltered());
416 else if (mode == 11){
417 oSC.
Update(MicrophoneFourierIT::GetSamples());
420 else if (mode == 12){
421 sA.
Update(MicrophoneFourierIT::GetFourierFiltered());
444 float scale = menuRatio * 0.6f + 0.4f;
445 float faceSizeOffset = faceSize * 8.0f;
453 pM.GetObject()->GetTransform()->SetPosition(
Vector3D(xOffset, yOffset - 93.0f *
offsetFace, 0.0f));
454 pM.GetObject()->UpdateTransform();
456 pME.GetObject()->UpdateTransform();
A class for managing the Adafruit APDS9960 sensor.
static bool Initialize(uint8_t threshold)
Initializes the APDS9960 sensor.
static bool isBooped()
Checks if the sensor is "booped" (close proximity detected).
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 material class for creating an audio-reactive gradient effect.
void SetRadius(float radius)
Sets the radius for circular gradient patterns.
void SetPosition(Vector2D offset)
Sets the position of the gradient.
void Update(float *readData)
Updates the gradient based on new audio data.
void SetSize(Vector2D size)
Sets the size of the gradient.
void SetRotation(float angle)
Sets the rotation angle of the gradient.
void SetHueAngle(float hueAngle)
Sets the hue angle for color adjustments.
A template class for animating eye blinking using keyframes.
FunctionGenerator fGenMatHue
SimpleMaterial greenMaterial
FunctionGenerator fGenMatYMove
MaterialAnimator< 5 > backgroundMaterial
void Initialize() override
SimpleMaterial redMaterial
void UpdateKeyFrameTracks()
RainbowSpiral rainbowSpiral
SimpleMaterial blueMaterial
FunctionGenerator fGenMatRMenu
void AudioReactiveGradientFace()
SimpleMaterial yellowMaterial
EasyEaseAnimator< 25 > eEA
LEDStripBackground ledStripBackground
void ChangeInterpolationMethods()
GradientMaterial< 2 > gradientMat
void SpectrumAnalyzerFace()
FunctionGenerator fGenMatPos
FunctionGenerator fGenScale
FunctionGenerator fGenRotation
SimpleMaterial orangeMaterial
FunctionGenerator fGenMatXMenu
void FadeIn(float stepRatio) override
void FadeOut(float stepRatio) override
RainbowNoise rainbowNoise
FunctionGenerator fGenMatYMenu
FunctionGenerator fGenMatXMove
MaterialAnimator< 10 > materialAnimator
SimpleMaterial purpleMaterial
void Update(float ratio) override
FFTVoiceDetection< 128 > voiceDetection
RGBColor gradientSpectrum[2]
uint8_t GetAccentBrightness()
SimpleMaterial whiteMaterial
AudioReactiveGradient aRG
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 SetThreshold(float threshold)
Sets the threshold for formant calculations.
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.
@ Triangle
Triangle waveform.
float Update()
Updates and calculates the next value of the waveform.
Creates a customizable gradient material for rendering.
void SetRotationAngle(float rotationAngle)
Sets the rotation angle for the gradient.
Animates transitions and blends between multiple materials.
void AddMaterial(Material::Method method, Material *material, uint16_t frames, float minOpacity, float maxOpacity)
Adds a material to the animation with specified properties.
void SetBaseMaterial(Material::Method method, Material *material)
Sets the base material for the animation.
void AddMaterialFrame(Material &material, float opacity)
Adds a specific frame for a material in the animation.
void Update()
Updates the animator, advancing the transitions.
@ Lighten
Chooses the lighter color.
@ Add
Adds colors together.
@ Replace
Replaces the base color.
Represents a 3D object with geometry, material, and transformation data.
Handles aligning and transforming 3D objects to fit within specified 2D camera bounds.
void SetEdgeMargin(float edgeMargin)
Sets the margin to keep from the edges when aligning objects.
@ Stretch
Attempt to scale the object(s) to fill the entire area.
void SetJustification(Justification jst)
Sets the justification mode for alignment.
void SetPlaneOffsetAngle(float offsetPlaneAngle)
Sets the additional rotation offset (plane offset angle), in degrees or radians, that will be applied...
void SetCameraMax(Vector2D camMax)
Updates the maximum bounds for the 2D camera region.
void AlignObjects(Object3D **objs, uint8_t numObjects)
Aligns multiple objects within the camera bounds, including scale factors.
void SetMirrorX(bool mirrorX)
Enables or disables mirroring along the X-axis for the aligned objects.
void SetMirrorY(bool mirrorY)
Enables or disables mirroring along the Y-axis for the aligned objects.
A dynamic oscilloscope material for visualizing audio signals.
void SetPosition(Vector2D offset)
Sets the position of the oscilloscope visualization.
void SetSize(Vector2D size)
Sets the size of the oscilloscope visualization.
void Update(float *data)
Updates the oscilloscope visualization based on new audio data.
void SetHueAngle(float hueAngle)
Sets the hue angle for color adjustments.
A mathematical construct representing a rotation in 3D space.
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 dynamic material creating a colorful rainbow spiral animation.
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.