Randomizing animations

i want to create an animated, looping symbol, place it on the stage multiple times… and have each one randomly pause then play and loop. the problem is, i cannot target each symbol’s timeline independently. my example randomizes the start times… however the “loop” resets all symbols. (http://codifydesign.com/temp/randomized-hype/) – is there anyway to target each symbol’s timeline independently in hype? like the water drops on the monster that i animated for adobe (http://codifydesign.com/chris/samples/kaiju/)

Yes, you can target symbol instance timelines independently. You’d need to give the symbol element an ID or could use the getSymbolInstancesByName() API if you wanted all of them. Here’s what the code would basically look like:

var symbolInstances = hypeDocument.getSymbolInstancesByName('MySymbol');
var randomIndex = Math.floor(Math.random() * symbolInstances.length);
symbolInstances[randomIndex].startTimelineNamed('My Timeline');

Here’s an example, using the ID method : RandomSymbol.hype.zip (18.5 KB)


i didn’t realize the reference starting with hypeDocument would let me target timelines in symbol instances. i used your suggestion of “var symbolInstance = hypeDocument.getSymbolInstanceById(element.id);” to reference each instance timeline, and was able to start each timeline at a different pace, and each looped individually. thanks so much jonathan!!

1 Like

A post was split to a new topic: Animate one element and hide others