From 6f5d7338d074a76e0d274c6d3f0b4a862979dde5 Mon Sep 17 00:00:00 2001 From: Mashy Date: Sat, 26 Oct 2019 21:48:12 +1000 Subject: [PATCH] catch null idle case --- client/src/components/anims/wiggle.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/components/anims/wiggle.jsx b/client/src/components/anims/wiggle.jsx index e071450b..5886a47d 100644 --- a/client/src/components/anims/wiggle.jsx +++ b/client/src/components/anims/wiggle.jsx @@ -1,11 +1,12 @@ const anime = require('animejs').default; function wiggle(id, idle) { + if (!idle) return true; const duration = 300; const target = document.getElementById(id); const x = window.innerWidth * 0.01 * (Math.round(Math.random()) ? Math.random() : -Math.random()); const y = window.innerHeight * 0.01 * (Math.round(Math.random()) ? Math.random() : -Math.random()); - + const originalX = parseFloat(idle.animations[0].currentValue); const originalY = parseFloat(idle.animations[1].currentValue); // console.log(x, y);