Using a state and a timeline

Hey All,

Is it possible to utilize both a state and a timeline? For example, once my AR experience is triggered via zapping, the animation in the timeline will play, then it’ll switch states from state 1 to state 2.

Thank you!

Are the properties your are using in the both the timeline and states?
If so you may have to play with it a bit but should still be able to.
If not then yes

Steve

1 Like

Hi @mattdlmag,

Once a timeline has completed playback, the content will keep the values specified at the end of the timeline (assuming the animation hasn’t been set to loop).

With this, you could simply create keyframes with the values that you want the object(s) to keep at the end of the timeline. This is assuming, as Steve said, that your states and timeline are using the same properties, under the same Controller.

If they are managing different properties (or different objects) then you can use the animation’s .on("complete", ..._) event handler and activate your state within it. This would activate the state when the timeline finished playback.

You can find more information on easily creating event handlers and activating states over on our Scripting Tips and Tricks article.

Hope this helps.

All the best,
Seb

2 Likes