So I have this JSON object given for my project. It contain multiple settings, some of them are strings some are booleans.
However I am unable to perform one thing, which is adding animation name from the object stored in variable.
aniFx.move(inner, {
duration: 1,
delta: aniFx.ease.bouncePast
});
Explanation
Inner: document.getElementById('inner');
Duration: time multiplied by 1000 in my animation script (aniFx)
Delta: Animation used for moving the inner element
So now that I explained, that is working perfectly fine, until I try to set delta
from JSON object.
Let's say for sake of this question that my JSON object contains only following:
_userObj = JSON.parse('{ "137340": { "effect": "aniFx.ease.swingTo" } }');
Now, why I am unable to do this for example:
aniFx.move(inner, {
duration: 1,
delta: _userObj['137340'].effect
});
I will get following error when I trigger the function...
Console will return:
console.log => aniFx.ease.swingTo
aniFx.move => Uncaught TypeError: string is not a function