MCPcopy Create free account
hub / github.com/Blueforcer/awtrix3 / zoomTransition

Method zoomTransition

src/MatrixDisplayUi.cpp:660–705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

658}
659
660void MatrixDisplayUi::zoomTransition()
661{
662 float progress = (float)this->state.ticksSinceLastStateSwitch / (float)this->ticksPerTransition;
663 float scale = 1.0;
664 // If zooming out the old app
665 if (progress < 0.5)
666 {
667 scale = 1 - progress * 2; // scale will change from 1.0 to 0.0
668 (this->AppFunctions[this->state.currentApp])(this->matrix, &this->state, 0, 0, &gif1);
669 }
670 else
671 {
672 // Otherwise zooming in the new app
673 scale = (progress - 0.5) * 2; // scale will change from 0.0 to 1.0
674 (this->AppFunctions[this->getnextAppNumber()])(this->matrix, &this->state, 0, 0, &gif2);
675 }
676
677 // Copy the data to the temporary array ledsCopy
678 for (int i = 0; i < 32; i++)
679 {
680 for (int j = 0; j < 8; j++)
681 {
682 ledsCopy[i + j * 32] = DisplayManager.getLeds()[this->matrix->XY(i, j)];
683 }
684 }
685
686 // Scale the data and copy back to the matrix
687 for (int i = 0; i < 32; i++)
688 {
689 for (int j = 0; j < 8; j++)
690 {
691 int iScaled = 16 + (i - 16) * scale;
692 int jScaled = 4 + (j - 4) * scale;
693
694 if (iScaled < 0)
695 iScaled = 0;
696 if (iScaled >= 32)
697 iScaled = 31;
698 if (jScaled < 0)
699 jScaled = 0;
700 if (jScaled >= 8)
701 jScaled = 7;
702 DisplayManager.getLeds()[this->matrix->XY(i, j)] = ledsCopy[iScaled + jScaled * 32];
703 }
704 }
705}
706
707void MatrixDisplayUi::rotateTransition()
708{

Callers

nothing calls this directly

Calls 2

getnextAppNumberMethod · 0.95
getLedsMethod · 0.80

Tested by

no test coverage detected