mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-29 19:00:33 +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;
|
||||
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);
|
||||
if(Appearance.Border == 1)
|
||||
|
@@ -76,5 +76,5 @@ void ProgressBar::Draw(const Point &screenPos)
|
||||
|
||||
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 lineInner = (Size.X/2);
|
||||
int lineOuter = (Size.X/2)+3;
|
||||
auto cValue = std::floor(ui::Engine::Ref().LastTick() * 0.015f) * 0.25f;
|
||||
for(float t = 0.0f; t < 6.0f; t+=0.25f)
|
||||
auto cValue = std::floor(ui::Engine::Ref().LastTick() * 0.015) * 0.25;
|
||||
for(double t = 0.0; t < 6.0; t+=0.25)
|
||||
{
|
||||
g->DrawLine(
|
||||
{ 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()
|
||||
{
|
||||
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();
|
||||
if (done)
|
||||
Exit();
|
||||
|
Reference in New Issue
Block a user