From 296f9b9da52e672ae60c1c25258a7f4e04161a94 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 29 Jul 2021 11:26:01 -0400 Subject: [PATCH] Smoother bridge animation start/stop --- .../mindustry/world/blocks/distribution/ItemBridge.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/world/blocks/distribution/ItemBridge.java b/core/src/mindustry/world/blocks/distribution/ItemBridge.java index f8f3af4ab9..ffdcc793d0 100644 --- a/core/src/mindustry/world/blocks/distribution/ItemBridge.java +++ b/core/src/mindustry/world/blocks/distribution/ItemBridge.java @@ -178,7 +178,7 @@ public class ItemBridge extends Block{ public int link = -1; public IntSeq incoming = new IntSeq(false, 4); public float warmup; - public float time; + public float time, timeSpeed; public boolean wasMoved, moved; public float transportCounter; @@ -295,7 +295,10 @@ public class ItemBridge extends Block{ moved = false; } - time += wasMoved ? delta() : 0f; + //smooth out animation, so it doesn't stop/start immediately + timeSpeed = Mathf.approachDelta(timeSpeed, wasMoved ? 1f : 0f, 1f / 60f); + + time += timeSpeed * delta(); checkIncoming();