Ah... tricky... the alp(0) is on the whole container of the LabelWords - which is the Wrapper. The alpha of the sequence animation is on each word. You can use the set:{alpha:0} in the animate() or just animate to alpha:0 if that works for you.
Consider using a function instead so you aren't put in the delicate position repeating the variable name within itself (DRY). The below allows you to use "this" instead...
// Demo object
const cciText = {
labels: [
{name: "a", val: "1"},
{name: "b", val: "2"},
{name: "c", val: "3"}
]
};
// To have "this", use a normal function NOT arrow function
cciText.set = function (props) {
this.labels.forEach(label => Object.assign(label, props));
}
// Test
cciText.set({alpha: 0});
console.log(JSON.stringify(cciText.labels));
That is, the only thing that might not work is the forEach on labels, cuz I don't know what labels is. But since you've confirmed using loop, you can be sure it will work with that.
Well then as an array, which was my original assumption, you can use my first or second example. It's all the same.
It doesn't matter that they are ZIM objects, if that's what you mean. ZIM objects are JS objects, and in your own code you are using them as such (label[prop] = x). So, any sort of normal property modification will have the same effect.
Anyway, it's a quick test to be sure, and assuming it works, you now have way fewer moving parts and no dangerous self-referential variable names.
Thanks guys, this has been added to ZIM 016 in LabelLetters, LabelWords, Tile, and Wrapper as setProps() as createjs already has a set() method - which does something similar but not through an object's items. Hmm we maybe could have put it on a container... but leaving that for now as many containers do not have repeating objects so might not make sense.
new LabelLetters().center().setProps({color:series(pink,blue)});
new LabelWords()
.center()
.setProps({
rotation:{min:10,max:20,negative:true},
font:["verdana", "courier"]
});
I have closed this topic. Can anyone reading this try and reply to it below to see if you guys can reply to a closed topic. If you can't reply, then could you give this message a like? Thanks.