I have a function through which I pass some variables as arguments. I need some of those to become variable names or object property names.
key(500, 'door', 10, 'bounceOut', 'regY', -150, 5, 'bounceIn');
function key(point, instance, speed, ease, prop, value, speed2, ease2, prop2, value2){
ani.instance = true;
createjs.Tween.get(instance, {override: true}).to({prop: value}, -(value + -instance.prop) * speed, createjs.Ease.ease);
}
The solution stated here should have worked, but it does nothing for me.
// ani.instance changed to:
ani[instance]; // no error here
// instance.prop changed to:
instance[prop]; // returns 'undefined', expected it to return 'door[regY]'. instance and prop return 'door' and 'regY' respectively though
What is going on here? Can anyone nudge me in the right direction? Thank you :)
EDIT What I want the code to read is:
door.regY = 200;
createjs.Tween.get(door, {override: true}).to({regY: -150}, -(-150 + -door.regY) * 10, createjs.Ease.bounceOut);