Skip to content

Commit 828568e

Browse files
authored
fix math
1 parent 48e952b commit 828568e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/addons/addons/editor-animations/userscript.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ export default async function({ addon }) {
118118
animateButtons = addon.settings.get("animateButtons");
119119

120120
const oldSpeed = animationSpeed;
121-
animationSpeed = 5 - (Number(addon.settings.get("animateSpeed")) / 100);
121+
animationSpeed = 1 / (Number(addon.settings.get("animateSpeed")) / 100);
122122
if (oldSpeed !== animationSpeed) styleElement.textContent = genStyles();
123123
}
124124

125125
function getAnim(time) {
126-
time *= animationSpeed;
126+
time /= animationSpeed;
127127
return `${time}s ${cubicAnimation}`;
128128
};
129129

@@ -189,7 +189,7 @@ export default async function({ addon }) {
189189

190190
const animation = element.animate(
191191
[{ height: "0px", opacity: 0 }, { height: `${ogHeight}px`, opacity: 1 }],
192-
{ duration: animTime * animationSpeed, easing: cubicAnimation }
192+
{ duration: animTime / animationSpeed, easing: cubicAnimation }
193193
);
194194
animation.onfinish = () => {
195195
element.style.overflow = "hidden";
@@ -207,7 +207,7 @@ export default async function({ addon }) {
207207

208208
element.animate(
209209
[{ transform: "scale(0)", opacity: 0 }, { transform: "scale(1)", opacity: 1 }],
210-
{ duration: animTime * animationSpeed, easing: cubicAnimation }
210+
{ duration: animTime / animationSpeed, easing: cubicAnimation }
211211
);
212212
}
213213

@@ -244,11 +244,11 @@ export default async function({ addon }) {
244244

245245
animClone.animate(
246246
[{ opacity: 1 }, { opacity: 0 }],
247-
{ duration: animTime * animationSpeed, easing: cubicAnimation }
247+
{ duration: animTime / animationSpeed, easing: cubicAnimation }
248248
);
249249
const animation = animClone.firstChild.animate(
250250
[{ transform: "scale(1)", opacity: 1 }, { transform: "scale(0)", opacity: 0 }],
251-
{ duration: animTime * animationSpeed, easing: cubicAnimation }
251+
{ duration: animTime / animationSpeed, easing: cubicAnimation }
252252
);
253253
animation.onfinish = () => {
254254
animClone.remove();

0 commit comments

Comments
 (0)