Forum Discussion
Easier way to do Transparent PNG animations in Storyline using AI Assistant.
I like this method. I've used the array of object IDs for a few different things now too--very helpful. Can I ask, was there a reason image states weren't used?
I've been working on a 2D, tile-based movement engine in Storyline and started creating a few animated image sequences by putting them all into the states of one image object, one state per PNG.
// An image object with four non-default states
const background = object('#id');
let i = 1;
setInterval(() => {
background.state = String(i);
i++;
if (i>4) i= 1;
}, 500);
Since the image states are named with simple numbers, the index of the loop is used to qualify the name of the state that should be shown. When i == 2, state "2" is shown.
I like this method over the array of object IDs (which I still use for other thing) since the Storyline image object becomes a convenient container for all of the images in the sequence, keeping my timeline much leaner.
- AlanCamerer-0cf2 days agoCommunity Member
Thanks for the reply! That's a great idea. So, do you still set up the states by hand with your method? That's the part I was trying to get past with JS. With a lot of short animations, that can get time-consuming and monotonous. (I'm getting less patient with long-form setup solutions.) If the AI Assistant can set up the states for you, that would definitely be better!
I haven't tried using AI Assistant to set up all the states for one image. I bet that it would since it is getting more Codex-like with aligning text to audio on the timeline, etc. Just takes the right sequence of prompts. Maybe not though. A possible feature request?
My solution has worked with the images in a group so that cleans up the timeline somewhat. If someone's network/LMS restrictions disallow JS, then yes, an alternative method would be needed. Thanks for sharing your solution!- AndrewBlemings-2 days agoCommunity Member
That's a really good point I accidentally glossed over, I didn't use the AI assistant. That it can collect the object IDs from the timeline is a huge boon. I've had mixed results with the AI assistant coming up with code in general, but its ability to interact with the timeline and the objects on it is very significant. I'll put a pin in trying that out.
Since I've been deliberately going for simpler four-frame animations, setting up the states was pretty quick for me. Duplicate the normal state, name the new state, right-click the image in the new state and replace it with the next one in the sequence from my local drive. Rinse, repeat.
As the number of images increases though, the AI method would no doubt become progressively more useful, and the 30 your script uses would probably be significantly slower using the method I described, good call. 30 is much bigger than four.