Scripting - Sharing Sequences

Mr Adventures
Commercial Pro Edition
Joined 22 August 2009
29 July 2010 10:36:15
Let us say that my scene has X number of objects and I want all of them to fade out over a period of 2 seconds. I have created a sequence for one object that performs this fade-out animation, but I want to run this sequence simultaneously on all other objects so that all of them fade out together. What is the best way to achieve this?

Thanks in advance.
Chris S
DX Studio Team
29 July 2010 10:43:49
You can create a sequence in code, assign the string keyframes that set the props, then apply to as many objects as you like.

var s = new Sequence("myfade2", 0.2);
s.createKeyframe(0.2, "<prop id='opacity' type='float' tweenin='stepped' value='0.0'/>");
var objs = scene.objectGetArray();
for(var i in objs)
{
    objs[i].sequencePlay(s);
}
fadetest.dxstudio
Chris S
DX Studio Team
29 July 2010 10:45:10
(Also what's neat about the above code is it will fade from whatever their opacity currently is, as the keyframe at 0.0 seconds is implicitly their current value).
Mr Adventures
Commercial Pro Edition
Joined 22 August 2009
29 July 2010 10:57:08
Thank you, that works splendidly

If you'd like to post to this forum, just create an account on the website, or login with your existing details.

When posting to a forum, you can use limited HTML tags:- 'a' for links, 'b' for bold, 'i' for italic and 'script' to encase a block of DX Studio script.  All tags must be properly closed. e.g. <script>var i=1;</script>

Note: If there are any offensive comments in this topic, please let us know straight away at . Always follow the forum rules.