I’m trying to create a lot of identical objects and control their visibility randomly. Seems easy, but not so much. I did find that after cloning the objects with JS (thanks to @Cescomare), I could control the visibility of the objects in reverse order. It seems odd that I can control their visibility, but not assign them to an array of IDs. In my example, those last two are invisible, even though I addressed  and . Still, I seem to be able to address them? (/me braces himself for scorn and ridicule.)
I ended up doing this the hard way, duplicating the “on” bulb 2,043 times (easy) and naming every instance with a unique, sequential ID (annoying and time consuming).
My question is, can I create one symbol of “bulbOn”, and using JS, duplicate it with loops, giving each instance its own unique ID.
I will spare you my failed attempts.
Since creating the original, I’ve been using this file to learn more about controlling animations in Hype with JS. I’ve found timing and the asynchronous nature of JS to be frustrating. I finally got a random flashing, and (just now) a waterfall version of the marquee working. I suspect that it’s much more processor-intensive than it needs to be, since each instance is its own SVG. It certainly makes the graphic portion of the file difficult to work on. Scrolling, selecting, zooming, etc. are slow and crashy. I finally feel like I have spent enough time trying, and have enough basic understanding to ask "how should I have created 2,043 uniquely ID’d instances-isn’t there a much better way?"saylers-left-random-flashing.hype.zip (218.4 KB) saylers-by-rows.hype.zip (221.9 KB)
Exactly! The cloning! I thought that part would be relatively easy, and I didn’t find a lot of useful examples or reference for a noob like me. It seemed like it would be a common enough technique, especially when one doesn’t know how many of a particular object will be used, or, as in this case, when a lot of duplicate objects are needed. OR I might just be bad at searching.
Thank you for not only taking the time to point me toward the clone extension, but also apply it to this situation. It looks like the clone extension was there all along and I missed it in my searches. Hopefully this application will be helpful to others! OH! And thanks for writing the clone extension in the first place!
What follows is a little off topic here (no clones involved) - but it occurred to me an alternate~easy way to do the cascading light effect on Jeremy’s “Saylers” project would be with a symbol. The following uses eight symbol instances of a master. The cascading lights (5 row) are a screen grab. No coding, just timeline. I used Jeremy’s “bulbs off” background - but it could have been a repeating pattern background image matrix of 7x7 “off” bulbs (to match 28 to a row) to really go lightweight.
The other nice thing about that is CPU.
Going in I knew the amount of elements would be a CPU hog but since this thread is ‘Clone’ I avoided thinking of doing things different with the number of objects but @jims approuch is always best if you can go down that road.
This is useful, in case I need to make adjustments or the client want to add or remove certain features from the thumbnail, I would only edit the master / original symbol, and this is going to be reflected on all 150 thumbnails I am supposed to create.