Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Better anime.setValue

Julian Garnier1ce8c1721ae8
diff --git a/anime.js b/anime.js
index 8e86a1ba..7aa4af53 100644
--- a/anime.js
+++ b/anime.js
@@ -631,8 +631,11 @@
function setTargetValue(targets, property, value) {
const animatables = getAnimatables(targets);
animatables.forEach(animatable => {
+ const originalValue = getOriginalTargetValue(animatable.target, property, animatable);
+ const unit = getUnit(value) || getUnit(originalValue);
+ const to = getRelativeValue(validateValue(value, unit), originalValue);
const animType = getAnimationType(animatable.target, property);
- setProgressValue[animType](animatable.target, property, value, animatable.transforms, false, true);
+ setProgressValue[animType](animatable.target, property, to, animatable.transforms, false, true);
});
}