From 12f2473ebe52bae606d1fb3ea34f0e0892232a9f Mon Sep 17 00:00:00 2001 From: Gavin <5265021+g-a-v-i-n@users.noreply.github.com> Date: Thu, 4 Aug 2022 13:22:40 -0700 Subject: [PATCH] Ga/animation fix (#88) * fix: cheek color * fix animation reversal --- src/libraries/Body.sol | 2 +- src/libraries/Cheeks.sol | 2 +- src/libraries/Face.sol | 6 +++++- src/libraries/Glints.sol | 2 +- src/libraries/Motes.sol | 6 +++++- src/libraries/SVG.sol | 18 +++++++++++------- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/libraries/Body.sol b/src/libraries/Body.sol index 961b486..d4bb300 100644 --- a/src/libraries/Body.sol +++ b/src/libraries/Body.sol @@ -65,7 +65,7 @@ library Body { _mixMode: _mixMode, _attributes: "" }), - SVG.element("animateMotion", SVG.animateMotionAttributes(reverse, dur, ""), Data.mpathJitterLg()), + SVG.element("animateMotion", SVG.animateMotionAttributes(reverse, dur, "linear"), Data.mpathJitterLg()), (_tokenId == 0) ? _genesis(bodyFill1, bodyFill2, dur) : "" ); } diff --git a/src/libraries/Cheeks.sol b/src/libraries/Cheeks.sol index 286eb90..2fa3c1d 100644 --- a/src/libraries/Cheeks.sol +++ b/src/libraries/Cheeks.sol @@ -42,7 +42,7 @@ library Cheeks { function _big() internal pure returns (string memory) { return string.concat( - "", + "", "", "", "" diff --git a/src/libraries/Face.sol b/src/libraries/Face.sol index f0048ff..1712dda 100644 --- a/src/libraries/Face.sol +++ b/src/libraries/Face.sol @@ -49,7 +49,11 @@ library Face { Eyes.render(_seed), Mouth.render(_seed), Cheeks.render(_seed), - SVG.element("animateMotion", SVG.animateMotionAttributes(reverse, "11s", ""), Data.mpathJitterLg()) + SVG.element( + "animateMotion", + SVG.animateMotionAttributes(reverse, "11s", "linear"), + Data.mpathJitterLg() + ) ); } } diff --git a/src/libraries/Glints.sol b/src/libraries/Glints.sol index 200f6ca..69e7312 100644 --- a/src/libraries/Glints.sol +++ b/src/libraries/Glints.sol @@ -84,7 +84,7 @@ library Glints { ), SVG.element( "animateMotion", - SVG.animateMotionAttributes(_reverse, _durationLong, ""), + SVG.animateMotionAttributes(_reverse, _durationLong, "linear"), Data.mpathJitterLg() ) ); diff --git a/src/libraries/Motes.sol b/src/libraries/Motes.sol index 22b951c..e26459a 100644 --- a/src/libraries/Motes.sol +++ b/src/libraries/Motes.sol @@ -88,7 +88,11 @@ library Motes { SVG.element( "circle", SVG.circleAttributes(_radius, _coords, "white", _opacity, "lighten", ""), - SVG.element("animateMotion", SVG.animateMotionAttributes(_reverse, _dur, ""), Data.mpathJitterSm()) + SVG.element( + "animateMotion", + SVG.animateMotionAttributes(_reverse, _dur, "linear"), + Data.mpathJitterSm() + ) ); } diff --git a/src/libraries/SVG.sol b/src/libraries/SVG.sol index 61eaf55..4b75adb 100644 --- a/src/libraries/SVG.sol +++ b/src/libraries/SVG.sol @@ -160,14 +160,18 @@ library SVG { string memory _dur, string memory _calcMode ) internal pure returns (string memory) { - string memory reverse = _reverse ? "keyPoints='1;0' keyTimes='0;1'" : ""; + string memory reverse = _reverse ? "keyPoints='1;0' keyTimes='0;1'" : "keyPoints='0;1' keyTimes='0;1'"; - // Firefox has issues with calcMode="linear", even thought it is the default. - string memory calcModeStr = bytes(_calcMode).length == 0 - ? "" - : string.concat("calcMode=", Util.quote(_calcMode)); - - return string.concat(reverse, " ", "dur=", Util.quote(_dur), 'repeatCount="indefinite" ', calcModeStr); + return + string.concat( + reverse, + " ", + "dur=", + Util.quote(_dur), + 'repeatCount="indefinite" ', + "calcMode=", + Util.quote(_calcMode) + ); } function filterAttribute(string memory _id) internal pure returns (string memory) {