ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
AlphaProject.h
Go to the documentation of this file.
1#pragma once
2
3#include "Animation.h"
4#include "KeyFrameTrack.h"
5#include "EasyEaseAnimator.h"
6#include "../Morph/ProtoDRMorph.h"
7#include "../Render/Scene.h"
8#include "../Signals/FunctionGenerator.h"
9
10#include "../Objects/Spyro.h"
11#include "../Objects/Background.h"
12
13#include "../Materials/Animated/AudioReactiveGradient.h"
14#include "../Materials/Animated/SpectrumAnalyzer.h"
15#include "../Materials/Animated/RainbowNoise.h"
16#include "../Materials/Animated/RainbowSpiral.h"
17#include "../Materials/CombineMaterial.h"
18#include "../Materials/GradientMaterial.h"
19#include "../Materials/MaterialAnimator.h"
20#include "../Materials/NormalMaterial.h"
21#include "../Materials/StripeMaterial.h"
22
23#include "../Signals/FFTVoiceDetection.h"
24#include "../Sensors/MenuButtonHandler.h"
25#include "../Sensors/SerialSync.h"
26#include "../Sensors/MicrophoneFourier_MAX9814.h"
27
28class AlphaAnimation : public Animation<2>{
29private:
30 ProtoDR pM;
31 Background background;
32 Spyro spyro;
33 EasyEaseAnimator<30> eEA = EasyEaseAnimator<30>(EasyEaseInterpolation::Cosine);
34
35 //Materials
36 RGBColor gradientSpectrum[6] = {RGBColor(255, 0, 0), RGBColor(255, 255, 0), RGBColor(0, 255, 0), RGBColor(0, 255, 255), RGBColor(0, 0, 255), RGBColor(255, 0, 255)};
37
45
47
49
50 SpectrumAnalyzer sA = SpectrumAnalyzer(Vector2D(430, 300), Vector2D(15, 120), true, true);
52
61
73
75
76 bool talk = true;
77
87
89 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::BlushEye), ProtoDR::BlushEye, 40, 0.0f, 1.0f);
90 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::HideBlush), ProtoDR::HideBlush, 10, 1.0f, 0.0f);
91 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::HideEyeBrow), ProtoDR::HideEyeBrow, 10, 0.0f, 1.0f);
92 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::OwOMouth), ProtoDR::OwOMouth, 60, 0.0f, 1.0f);
93
94 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::SadEye), ProtoDR::SadEye, 70, 0.0f, 1.0f);
95 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::SadEyeBrow), ProtoDR::SadEyeBrow, 80, 0.0f, 1.0f);
96 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::SadMouth), ProtoDR::SadMouth, 90, 0.0f, 1.0f);
97
98 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::FlatMouth), ProtoDR::FlatMouth, 50, 0.0f, 1.0f);
99 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::DeadEye), ProtoDR::DeadEye, 1, 0.0f, 1.0f);
100
101 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::HeartEye), ProtoDR::HeartEye, 30, 0.0f, 1.0f);
102
103 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::OwO), ProtoDR::OwO, 90, 0.0f, 1.0f);
104
105 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::AlphaGenCircle), ProtoDR::AlphaGenCircle, 90, 0.0f, 1.0f);
106 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::AlphaGenSquare), ProtoDR::AlphaGenSquare, 90, 0.0f, 1.0f);
107 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::HideAll), ProtoDR::HideAll, 90, 0.0f, 1.0f);
108
109 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::NewFins), ProtoDR::NewFins, 90, 0.0f, 1.0f);
110 eEA.AddParameter(pM.GetMorphWeightReference(ProtoDR::AngryEyeMouth), ProtoDR::AngryEyeMouth, 90, 0.0f, 1.0f);
111 }
112
114 blink.AddParameter(pM.GetMorphWeightReference(ProtoDR::ClosedEye));
115
116 topFinOuter.AddParameter(pM.GetMorphWeightReference(ProtoDR::TopFinOuterThin));
117 topFinInner.AddParameter(pM.GetMorphWeightReference(ProtoDR::TopFinInnerThin));
118 topFinGap.AddParameter(pM.GetMorphWeightReference(ProtoDR::TopFinInnerCloseGap));
119
120 midFin.AddParameter(pM.GetMorphWeightReference(ProtoDR::MidFinBotThin));
121 midFin.AddParameter(pM.GetMorphWeightReference(ProtoDR::MidFinMidBigger));
122 midFin.AddParameter(pM.GetMorphWeightReference(ProtoDR::MidFinTopThin));
123
124 botFinLR1.AddParameter(pM.GetMorphWeightReference(ProtoDR::BotFinLR1Thin));
125 botFinLR2.AddParameter(pM.GetMorphWeightReference(ProtoDR::BotFinLR2Thin));
126 botFinLR3.AddParameter(pM.GetMorphWeightReference(ProtoDR::BotFinLR3Thin));
127 botFinLR4.AddParameter(pM.GetMorphWeightReference(ProtoDR::BotFinLR4Thin));
128 botFinLR5.AddParameter(pM.GetMorphWeightReference(ProtoDR::BotFinLR5Thin));
129
130 mouth.AddParameter(pM.GetMorphWeightReference(ProtoDR::ShockedMouth));
131 }
132
134 blink.AddKeyFrame(0.0f, 0.0f);
135 blink.AddKeyFrame(2.75f, 0.0f);
136 blink.AddKeyFrame(3.0f, 1.0f);
137 blink.AddKeyFrame(3.25f, 0.0f);
138 blink.AddKeyFrame(9.75f, 0.0f);
139 blink.AddKeyFrame(10.0f, 1.0f);
140 blink.AddKeyFrame(10.25f, 0.0f);
141 blink.AddKeyFrame(10.75f, 0.0f);
142 blink.AddKeyFrame(11.0f, 1.0f);
143 blink.AddKeyFrame(11.25f, 0.0f);
144 blink.AddKeyFrame(15.0f, 0.0f);
145 }
146
148 topFinOuter.AddKeyFrame(0.0f, 0.0f);
149 topFinOuter.AddKeyFrame(1.5f, 1.0f);
150 topFinOuter.AddKeyFrame(3.0f, 0.0f);
151
152 topFinInner.AddKeyFrame(0.0f, 0.0f);
153 topFinInner.AddKeyFrame(0.5f, 0.0f);
154 topFinInner.AddKeyFrame(1.5f, 1.0f);
155 topFinInner.AddKeyFrame(2.5f, 0.0f);
156 topFinInner.AddKeyFrame(3.0f, 0.0f);
157
158 topFinGap.AddKeyFrame(0.0f, 0.0f);
159 topFinGap.AddKeyFrame(1.0f, 0.0f);
160 topFinGap.AddKeyFrame(1.5f, 1.0f);
161 topFinGap.AddKeyFrame(2.0f, 0.0f);
162 topFinGap.AddKeyFrame(3.0f, 0.0f);
163 }
164
166 midFin.AddKeyFrame(0.0f, 0.0f);
167 midFin.AddKeyFrame(2.5f, 1.0f);
168 midFin.AddKeyFrame(5.0f, 0.0f);
169 }
170
172 botFinLR1.AddKeyFrame(0.0f, 0.0f);
173 botFinLR2.AddKeyFrame(0.0f, 0.0f);
174 botFinLR3.AddKeyFrame(0.0f, 0.0f);
175 botFinLR4.AddKeyFrame(0.0f, 0.0f);
176 botFinLR5.AddKeyFrame(0.0f, 1.0f);
177
178 botFinLR1.AddKeyFrame(0.25f, 1.0f);
179 botFinLR2.AddKeyFrame(0.25f, 0.0f);
180 botFinLR3.AddKeyFrame(0.25f, 0.0f);
181 botFinLR4.AddKeyFrame(0.25f, 0.0f);
182 botFinLR5.AddKeyFrame(0.25f, 0.0f);
183
184 botFinLR1.AddKeyFrame(0.5f, 0.0f);
185 botFinLR2.AddKeyFrame(0.5f, 1.0f);
186 botFinLR3.AddKeyFrame(0.5f, 0.0f);
187 botFinLR4.AddKeyFrame(0.5f, 0.0f);
188 botFinLR5.AddKeyFrame(0.5f, 0.0f);
189
190 botFinLR1.AddKeyFrame(0.75f, 0.0f);
191 botFinLR2.AddKeyFrame(0.75f, 0.0f);
192 botFinLR3.AddKeyFrame(0.75f, 1.0f);
193 botFinLR4.AddKeyFrame(0.75f, 0.0f);
194 botFinLR5.AddKeyFrame(0.75f, 0.0f);
195
196 botFinLR1.AddKeyFrame(1.0f, 0.0f);
197 botFinLR2.AddKeyFrame(1.0f, 0.0f);
198 botFinLR3.AddKeyFrame(1.0f, 0.0f);
199 botFinLR4.AddKeyFrame(1.0f, 1.0f);
200 botFinLR5.AddKeyFrame(1.0f, 0.0f);
201
202 botFinLR1.AddKeyFrame(1.25f, 0.0f);
203 botFinLR2.AddKeyFrame(1.25f, 0.0f);
204 botFinLR3.AddKeyFrame(1.25f, 0.0f);
205 botFinLR4.AddKeyFrame(1.25f, 0.0f);
206 botFinLR5.AddKeyFrame(1.25f, 1.0f);
207 }
208
210 mouth.AddKeyFrame(0.0f, 0.0f);
211 mouth.AddKeyFrame(1.5f, 1.0f);
212 mouth.AddKeyFrame(4.0f, 0.0f);
213 }
214
215public:
217 scene.AddObject(pM.GetObject());
218 scene.AddObject(spyro.GetObject());
219 scene.AddObject(background.GetObject());
220
221 LinkEasyEase();
223
229
231
232 pM.GetObject()->SetMaterial(&materialAnimator);
233 background.GetObject()->SetMaterial(&sA);
234 }
235
236 void Initialize() override {
238 MenuButtonHandler::Initialize(15, 13, 1000);//7 is number of faces
239
240 MicrophoneFourier::Initialize(A8, 8000, 50.0f, 120.0f);//8KHz sample rate, 50dB min, 120dB max
241 }
242
243
257
258 void Default(){
259 pM.Reset();
260 blink.Play();
261 mouth.Play();
262
265 topFinGap.Play();
266 midFin.Play();
267 botFinLR1.Play();
268 botFinLR2.Play();
269 botFinLR3.Play();
270 botFinLR4.Play();
271 botFinLR5.Play();
272
273 talk = true;
274 }
275
276 void OwO(){
277 pM.Reset();
278 blink.Pause();
279 blink.Reset();
280 mouth.Play();
281
284 topFinGap.Play();
285 midFin.Play();
286 botFinLR1.Play();
287 botFinLR2.Play();
288 botFinLR3.Play();
289 botFinLR4.Play();
290 botFinLR5.Play();
291
292 eEA.AddParameterFrame(ProtoDR::BlushEye, 1.0f);
293 eEA.AddParameterFrame(ProtoDR::HideBlush, 0.0f);
294 eEA.AddParameterFrame(ProtoDR::HideEyeBrow, 1.0f);
295 eEA.AddParameterFrame(ProtoDR::OwOMouth, 1.0f);
296
297 talk = true;
298 }
299
300 void Sad(){
301 pM.Reset();
302 blink.Play();
303 mouth.Pause();
304 mouth.Reset();
305
308 topFinGap.Play();
309 midFin.Play();
310 botFinLR1.Play();
311 botFinLR2.Play();
312 botFinLR3.Play();
313 botFinLR4.Play();
314 botFinLR5.Play();
315
316 eEA.AddParameterFrame(ProtoDR::SadEye, 1.0f);
317 eEA.AddParameterFrame(ProtoDR::SadEyeBrow, 1.0f);
318 eEA.AddParameterFrame(ProtoDR::SadMouth, 1.0f);
319
321
322 talk = true;
323 }
324
325 void Dead(){
326 pM.Reset();
327 blink.Pause();
328 blink.Reset();
329 mouth.Pause();
330 mouth.Reset();
331
334 topFinGap.Play();
335 midFin.Play();
336 botFinLR1.Play();
337 botFinLR2.Play();
338 botFinLR3.Play();
339 botFinLR4.Play();
340 botFinLR5.Play();
341
343
344 eEA.AddParameterFrame(ProtoDR::FlatMouth, 1.0f);
345 eEA.AddParameterFrame(ProtoDR::DeadEye, 1.0f);
346
347 talk = true;
348 }
349
350 void Heart(){
351 pM.Reset();
352 blink.Pause();
353 blink.Reset();
354 mouth.Play();
355
358 topFinGap.Play();
359 midFin.Play();
360 botFinLR1.Play();
361 botFinLR2.Play();
362 botFinLR3.Play();
363 botFinLR4.Play();
364 botFinLR5.Play();
365
367
368 eEA.AddParameterFrame(ProtoDR::HeartEye, 1.0f);
369 eEA.AddParameterFrame(ProtoDR::HideEyeBrow, 1.0f);
370 eEA.AddParameterFrame(ProtoDR::OwOMouth, 1.0f);
371
372 talk = true;
373 }
374
375 void OwO2(){
376 pM.Reset();
377 blink.Pause();
378 blink.Reset();
379 mouth.Pause();
380 mouth.Reset();
381
385 midFin.Pause();
391
395 midFin.Reset();
401
402 eEA.AddParameterFrame(ProtoDR::HideBlush, 0.0f);
403 eEA.AddParameterFrame(ProtoDR::HideEyeBrow, 0.0f);
404 eEA.AddParameterFrame(ProtoDR::OwO, 1.0f);
405
407
408 talk = false;
409 }
410
412 pM.Reset();
413 blink.Pause();
414 blink.Reset();
415 mouth.Pause();
416 mouth.Reset();
417
421 midFin.Pause();
427
431 midFin.Reset();
437
438 pM.SetMorphWeight(ProtoDR::HideSecondEye, 0.0f);
439
440 eEA.AddParameterFrame(ProtoDR::HideBlush, 0.0f);
441 eEA.AddParameterFrame(ProtoDR::HideEyeBrow, 0.0f);
442 eEA.AddParameterFrame(ProtoDR::AlphaGenSquare, 1.0f);
443
444 talk = false;
445 }
446
448 pM.Reset();
449 blink.Pause();
450 blink.Reset();
451 mouth.Pause();
452 mouth.Reset();
453
457 midFin.Pause();
463
467 midFin.Reset();
473
474 pM.SetMorphWeight(ProtoDR::HideSecondEye, 0.0f);
475
476 eEA.AddParameterFrame(ProtoDR::HideBlush, 0.0f);
477 eEA.AddParameterFrame(ProtoDR::HideEyeBrow, 0.0f);
478 eEA.AddParameterFrame(ProtoDR::AlphaGenCircle, 1.0f);
479
480 talk = false;
481 }
482
483 void HideAll(){
484 pM.Reset();
485 blink.Pause();
486 blink.Reset();
487 mouth.Pause();
488 mouth.Reset();
489
493 midFin.Pause();
499
503 midFin.Reset();
509
510 pM.SetMorphWeight(ProtoDR::HideSecondEye, 0.0f);
511
512 eEA.AddParameterFrame(ProtoDR::HideBlush, 0.0f);
513 eEA.AddParameterFrame(ProtoDR::HideEyeBrow, 0.0f);
514 eEA.AddParameterFrame(ProtoDR::HideAll, 1.0f);
515
517
518 talk = false;
519 }
520
521 void SpyroDisplay(float ratio, bool normal){
522 pM.GetObject()->Disable();
523 spyro.GetObject()->Enable();
524
525 float x = fGenRotation.Update();
526 float sx = fGenScale.Update();
527
529
530 spyro.GetObject()->ResetVertices();
531
532 spyro.GetObject()->GetTransform()->SetRotation(rotation);
533 spyro.GetObject()->GetTransform()->SetScale(Vector3D(sx, sx, sx));
534 spyro.GetObject()->GetTransform()->SetPosition(Vector3D(0.0f, 30.0f, 600.0f));
535
536 spyro.GetObject()->UpdateTransform();
537
538 if(!normal){
539 spyro.GetObject()->SetMaterial(&spyro.material);
540 }
541 else{
542 spyro.GetObject()->SetMaterial(&normalMaterial);
543 }
544
545 talk = false;
546 }
547
548 void AngryFace(){
549 pM.Reset();
550 blink.Pause();
551 blink.Reset();
552 mouth.Pause();
553 mouth.Reset();
554
558 midFin.Pause();
564
568 midFin.Reset();
574
575 pM.SetMorphWeight(ProtoDR::HideSecondEye, 1.0f);
576
577 eEA.AddParameterFrame(ProtoDR::HideBlush, 1.0f);
578 eEA.AddParameterFrame(ProtoDR::HideEyeBrow, 1.0f);
579 eEA.AddParameterFrame(ProtoDR::NewFins, 1.0f);
580 eEA.AddParameterFrame(ProtoDR::AngryEyeMouth, 1.0f);
581
583
584 talk = false;
585 }
586
588 background.GetObject()->Enable();
589 pM.Reset();
590 blink.Pause();
591 blink.Reset();
592 mouth.Pause();
593 mouth.Reset();
594
598 midFin.Pause();
604
608 midFin.Reset();
614
615 pM.SetMorphWeight(ProtoDR::HideSecondEye, 0.0f);
616
617 eEA.AddParameterFrame(ProtoDR::HideBlush, 0.0f);
618 eEA.AddParameterFrame(ProtoDR::HideEyeBrow, 0.0f);
619 eEA.AddParameterFrame(ProtoDR::HideAll, 1.0f);
620
621 talk = false;
622
624 background.GetObject()->SetMaterial(&sA);
625 }
626
628 background.GetObject()->Enable();
629 pM.Reset();
630 blink.Pause();
631 blink.Reset();
632 mouth.Pause();
633 mouth.Reset();
634
638 midFin.Pause();
644
648 midFin.Reset();
654
655 pM.SetMorphWeight(ProtoDR::HideSecondEye, 0.0f);
656
657 eEA.AddParameterFrame(ProtoDR::HideBlush, 0.0f);
658 eEA.AddParameterFrame(ProtoDR::HideEyeBrow, 0.0f);
659 eEA.AddParameterFrame(ProtoDR::HideAll, 1.0f);
660
661 talk = false;
662
664 background.GetObject()->SetMaterial(&aRG);
665 }
666
667 void FadeIn(float stepRatio) override {}
668 void FadeOut(float stepRatio) override {}
669
671 return pM.GetObject();
672 }
673
674 float offset = 0.0f;
675
677 if(MenuButtonHandler::UseMicrophone()){
678 //eEA.AddParameterFrame(ProtoDR::::vrc_v_ss, MicrophoneFourier::GetCurrentMagnitude() / 2.0f);
679
682
683 //eEA.AddParameterFrame(NukudeFace::vrc_v_ee, voiceDetection.GetViseme(voiceDetection.EE));
684 //eEA.AddParameterFrame(NukudeFace::vrc_v_ih, voiceDetection.GetViseme(voiceDetection.AH));
685 //eEA.AddParameterFrame(NukudeFace::vrc_v_dd, voiceDetection.GetViseme(voiceDetection.UH));
686 //eEA.AddParameterFrame(NukudeFace::vrc_v_rr, voiceDetection.GetViseme(voiceDetection.AR));
687 //eEA.AddParameterFrame(NukudeFace::vrc_v_ch, voiceDetection.GetViseme(voiceDetection.ER));
688 //eEA.AddParameterFrame(NukudeFace::vrc_v_aa, voiceDetection.GetViseme(voiceDetection.AH));
689 //eEA.AddParameterFrame(NukudeFace::vrc_v_oh, voiceDetection.GetViseme(voiceDetection.OO));
690 }
691 }
692 }
693
694 void Update(float ratio) override {
695 pM.GetObject()->Enable();//Due to Spyro track
696 spyro.GetObject()->Disable();
697 background.GetObject()->Disable();
698
699 float x = sinf(ratio * 3.14159f / 180.0f * 360.0f * 2.0f) * 3.0f;
700 float y = cosf(ratio * 3.14159f / 180.0f * 360.0f * 3.0f) * 3.0f;
701
704 sA.SetRotation(20.0f);
705 sA.SetHueAngle(ratio * 360.0f * 4.0f);
706 sA.SetMirrorYState(true);//MenuButtonHandler::MirrorSpectrumAnalyzer());
707 sA.SetFlipYState(false);//!MenuButtonHandler::MirrorSpectrumAnalyzer());
708
710 aRG.SetHueAngle(ratio * 360.0f * 8.0f);
711 aRG.SetRotation(ratio * 360.0f * 2.0f);
712 aRG.SetPosition(Vector2D(15.0f + x * 4.0f, 120.0f + y * 4.0f));
713
715
716 #ifdef RIGHTFACE
718
719 //update offset only 2% of the time
720 if(SerialSync::GetRatio() < 0.02f){
721 if(ratio > SerialSync::GetRatio()) offset = ratio - 1.0f - SerialSync::GetRatio();
722 else offset = ratio - SerialSync::GetRatio();
723 }
724
725 //adjust current frame sync to new esp32
726 ratio = fmod(ratio - offset, 1.0f);//override input to synchronize from esp
727
728 uint8_t mode = SerialSync::GetMode();
729 float mouthMove = SerialSync::GetMouthMove();
730 #else
731 float mouthMove = MicrophoneFourier::GetCurrentMagnitude() / 2.0f;
732
733 uint8_t mode = MenuButtonHandler::GetFaceState();//change by button press
734 SerialSync::SetMouthMove(mouthMove);
738 #endif
739
740 #ifdef DEMOMODE
741 ratio = fmod(ratio - offset, 1.0f);//override input to synchronize from esp
742 mode = floor(Mathematics::Map(ratio, 0, 1, 0, 1.99f));
743 #endif
744
745 if (mode == 0) AudioReactiveGradientDisplay();
746 else if (mode == 1) OwO();
747 else if (mode == 2) Sad();
748 else if (mode == 3) Dead();
749 else if (mode == 4) Heart();
750 else if (mode == 5) SpyroDisplay(ratio, false);
751 else if (mode == 6) SpyroDisplay(ratio, true);
752 else if (mode == 7) AlphaGenSquare();//AlphaGenCircle();
753 else if (mode == 8) HideAll();
754 else if (mode == 9) SpectrumAnalyzerDisplay();
755 else if (mode == 10) AudioReactiveGradientDisplay();
756 else if (mode == 11) AngryFace();
757 else OwO2();
758
759
760 float shiftMat = fGenMatPos.Update();
764 stripe1.SetRotationAngle(ratio * 360.0f);
765 stripe1.SetPositionOffset(Vector2D(shiftMat, shiftMat));
766
767 rainbowNoise.Update(ratio);
768 rainbowSpiral.Update(ratio);
770
772
773 //if(talk) pM.SetMorphWeight(ProtoDR::OpenToothMouth, mouthMove);
774 eEA.Update();
775 pM.Update();
776
777 pM.GetObject()->GetTransform()->SetRotation(Vector3D(0, 180.0f, 0.0f));
778 pM.GetObject()->GetTransform()->SetPosition(Vector3D(x, y, 600.0f));
779 pM.GetObject()->GetTransform()->Scale(Vector3D(1.0f, 1.0f, 1.0f));
780
781 pM.GetObject()->UpdateTransform();
782 }
783};
Declares the EasyEaseAnimator template class for advanced animation easing.
Declares the KeyFrameTrack template class for managing keyframe-based animations.
SpectrumAnalyzer sA
void SpyroDisplay(float ratio, bool normal)
KeyFrameTrack< 1, 10 > botFinLR2
NormalMaterial normalMaterial
void Initialize() override
SimpleMaterial redMaterial
KeyFrameTrack< 1, 5 > mouth
void UpdateKeyFrameTracks()
void AddBlinkKeyFrames()
RainbowSpiral rainbowSpiral
SimpleMaterial blackMaterial
SimpleMaterial blueMaterial
MaterialAnimator< 7 > materialAnimator
KeyFrameTrack< 1, 10 > botFinLR4
void AlphaGenSquare()
void UpdateFFTVisemes()
KeyFrameTrack< 1, 10 > botFinLR1
KeyFrameTrack< 1, 10 > botFinLR3
KeyFrameTrack< 1, 10 > blink
KeyFrameTrack< 1, 5 > topFinGap
FunctionGenerator fGenMatOpacity
FunctionGenerator fGenMatPeriod
FunctionGenerator fGenMatPos
FunctionGenerator fGenScale
Background background
void SetMaterialLayers()
void AddMouthKeyFrames()
KeyFrameTrack< 1, 5 > topFinInner
FunctionGenerator fGenRotation
EasyEaseAnimator< 30 > eEA
RGBColor gradientSpectrum[6]
void AlphaGenCircle()
void FadeIn(float stepRatio) override
void SpectrumAnalyzerDisplay()
void FadeOut(float stepRatio) override
void AddBotFinKeyFrames()
RainbowNoise rainbowNoise
StripeMaterial stripe1
KeyFrameTrack< 1, 5 > topFinOuter
void AddTopFinKeyFrames()
void Update(float ratio) override
void AddMidFinKeyFrames()
KeyFrameTrack< 1, 5 > midFin
FFTVoiceDetection< 128 > voiceDetection
void LinkEasyEase()
void AudioReactiveGradientDisplay()
FunctionGenerator fGenMatWidth
KeyFrameTrack< 1, 10 > botFinLR5
void LinkParameters()
FunctionGenerator fGenMatSize
Object3D * GetObject()
FunctionGenerator fGenMatAmplitude
GradientMaterial< 6 > gradientMat
AudioReactiveGradient aRG
A material class for creating an audio-reactive gradient effect.
void SetPosition(Vector2D offset)
Sets the position of the gradient.
void Update(float *readData)
Updates the gradient based on new audio data.
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 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 AddParameter(float *parameter, uint16_t dictionaryValue, uint16_t frames, float basis, float goal) override
Adds a parameter to the animator.
Encapsulates a 3D rotation using Euler angles and a specific order of application.
Definition EulerAngles.h:25
Detects visemes based on FFT voice analysis.
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.
@ Sine
Sine waveform.
float Update()
Updates and calculates the next value of the waveform.
Creates a customizable gradient material for rendering.
@ Cosine
Smooth cosine interpolation.
A template class for managing animations with multiple parameters and keyframes.
void AddParameter(float *parameter)
Adds a parameter to the track.
void Play()
Resumes the animation.
void Reset()
Resets the animation track to its initial state.
void AddKeyFrame(float time, float value)
Adds a keyframe to the track.
void Pause()
Pauses the animation.
float Update()
Updates the animation track and computes the new parameter value.
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.
Definition Material.h:40
@ Add
Adds colors together.
Definition Material.h:35
@ Replace
Replaces the base color.
Definition Material.h:44
static T Map(T value, T inLow, T inMax, T outMin, T outMax)
Maps a value from one range to another.
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.
A material that visualizes surface normals as RGB colors.
Represents a 3D object with geometry, material, and transformation data.
Definition Object3D.h:28
A mathematical construct representing a rotation in 3D space.
Definition Quaternion.h:30
Represents an RGB color and provides methods for manipulation.
Definition RGBColor.h:23
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.
Handles 3D rotations and conversions between various rotation representations.
Definition Rotation.h:32
Quaternion GetQuaternion()
Gets the quaternion representation of the rotation.
Definition Rotation.cpp:234
static void SetMouthMove(float ratio)
static void SetMode(uint8_t mode)
static uint8_t GetMode()
static void SetRatio(float ratio)
static void Send()
static void Initialize()
Definition SerialSync.cpp:6
static float GetRatio()
static void Read()
static float GetMouthMove()
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 SetRotation(float angle)
Sets the rotation angle of the visualization.
void SetHueAngle(float hueAngle)
Sets the hue adjustment angle for the spectrum colors.
Generates striped patterns with configurable properties.
void SetStripeWidth(float stripeWidth)
Sets the stripe width.
void SetPositionOffset(Vector2D positionOffset)
Sets the position offset for the pattern.
void SetRotationAngle(float rotationAngle)
Sets the rotation angle for the pattern.
void SetWaveAmplitude(float waveAmplitude)
Sets the wave amplitude for the sinusoidal effect.
void SetWavePeriod(float wavePeriod)
Sets the wave period for the sinusoidal effect.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Definition Vector2D.h:27
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26
const EulerOrder EulerOrderXZYS
Order: X → Z → Y, static frame.