mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-30 11:19:51 +02:00
Fix some jerky animations on emscripten
This commit is contained in:
@@ -116,7 +116,7 @@ void Button::Draw(const Point& screenPos)
|
|||||||
bgColour = Appearance.BackgroundInactive;
|
bgColour = Appearance.BackgroundInactive;
|
||||||
if (Appearance.BackgroundPulse)
|
if (Appearance.BackgroundPulse)
|
||||||
{
|
{
|
||||||
backgroundColour.Alpha = uint8_t(backgroundColour.Alpha * ((std::sin(Engine::Ref().LastTick() / 1000.f * std::numbers::pi_v<float> * 2.f) + 1.f) / 2.f));
|
backgroundColour.Alpha = uint8_t(backgroundColour.Alpha * ((std::sin(Engine::Ref().LastTick() / 1000 * std::numbers::pi * 2) + 1) / 2));
|
||||||
}
|
}
|
||||||
g->BlendFilledRect(RectSized(Position + Vec2{ 1, 1 }, Size - Vec2{ 2, 2 }), backgroundColour);
|
g->BlendFilledRect(RectSized(Position + Vec2{ 1, 1 }, Size - Vec2{ 2, 2 }), backgroundColour);
|
||||||
if(Appearance.Border == 1)
|
if(Appearance.Border == 1)
|
||||||
|
@@ -76,5 +76,5 @@ void ProgressBar::Draw(const Point &screenPos)
|
|||||||
|
|
||||||
void ProgressBar::Tick()
|
void ProgressBar::Tick()
|
||||||
{
|
{
|
||||||
intermediatePos = std::fmod(ui::Engine::Ref().LastTick() * 0.06f, 100.f);
|
intermediatePos = float(std::fmod(ui::Engine::Ref().LastTick() * 0.06, 100.0));
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,8 @@ void Spinner::Draw(const Point& screenPos)
|
|||||||
int baseY = screenPos.Y+(Size.Y/2);
|
int baseY = screenPos.Y+(Size.Y/2);
|
||||||
int lineInner = (Size.X/2);
|
int lineInner = (Size.X/2);
|
||||||
int lineOuter = (Size.X/2)+3;
|
int lineOuter = (Size.X/2)+3;
|
||||||
auto cValue = std::floor(ui::Engine::Ref().LastTick() * 0.015f) * 0.25f;
|
auto cValue = std::floor(ui::Engine::Ref().LastTick() * 0.015) * 0.25;
|
||||||
for(float t = 0.0f; t < 6.0f; t+=0.25f)
|
for(double t = 0.0; t < 6.0; t+=0.25)
|
||||||
{
|
{
|
||||||
g->DrawLine(
|
g->DrawLine(
|
||||||
{ int(baseX+(std::sin(cValue+t)*lineInner)), int(baseY+(std::cos(cValue+t)*lineInner)) },
|
{ int(baseX+(std::sin(cValue+t)*lineInner)), int(baseY+(std::cos(cValue+t)*lineInner)) },
|
||||||
|
@@ -79,7 +79,7 @@ void TaskWindow::NotifyProgress(Task * task)
|
|||||||
|
|
||||||
void TaskWindow::OnTick()
|
void TaskWindow::OnTick()
|
||||||
{
|
{
|
||||||
intermediatePos = std::fmod(ui::Engine::Ref().LastTick() * 0.06f, 100.f);
|
intermediatePos = float(std::fmod(ui::Engine::Ref().LastTick() * 0.06, 100.0));
|
||||||
task->Poll();
|
task->Poll();
|
||||||
if (done)
|
if (done)
|
||||||
Exit();
|
Exit();
|
||||||
|
Reference in New Issue
Block a user