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

Method rotateTransition

src/MatrixDisplayUi.cpp:707–754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705}
706
707void MatrixDisplayUi::rotateTransition()
708{
709 float progress = (float)this->state.ticksSinceLastStateSwitch / (float)this->ticksPerTransition;
710 float angle = progress * 2 * PI; // Rotate 360 degrees over the transition
711
712 // Determine which app to draw
713 if (progress < 0.5)
714 {
715 // Rotate out the old app (progress from 0 to 0.5)
716 (this->AppFunctions[this->state.currentApp])(this->matrix, &this->state, 0, 0, &gif1);
717 }
718 else
719 {
720 // Rotate in the new app (progress from 0.5 to 1.0)
721 (this->AppFunctions[this->getnextAppNumber()])(this->matrix, &this->state, 0, 0, &gif2);
722 }
723
724 // Copy the data to the temporary array ledsCopy
725 for (int i = 0; i < 32; i++)
726 {
727 for (int j = 0; j < 8; j++)
728 {
729 ledsCopy[i + j * 32] = DisplayManager.getLeds()[this->matrix->XY(i, j)];
730 }
731 }
732
733 // Rotate the data and copy back to the matrix
734 for (int i = 0; i < 32; i++)
735 {
736 for (int j = 0; j < 8; j++)
737 {
738 int iRotated = i;
739 int jRotated = j;
740 rotate(iRotated, jRotated, angle);
741
742 if (iRotated < 0)
743 iRotated = 0;
744 if (iRotated >= 32)
745 iRotated = 31;
746 if (jRotated < 0)
747 jRotated = 0;
748 if (jRotated >= 8)
749 jRotated = 7;
750
751 DisplayManager.getLeds()[this->matrix->XY(i, j)] = ledsCopy[iRotated + jRotated * 32];
752 }
753 }
754}
755
756void MatrixDisplayUi::pixelateTransition()
757{

Callers

nothing calls this directly

Calls 3

getnextAppNumberMethod · 0.95
rotateFunction · 0.85
getLedsMethod · 0.80

Tested by

no test coverage detected