Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  Viewpoint XML Schema    I need to dalay a ActionAnimator

Moderators: e_phoenix13
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
<Prashant sharma>
Posted
My Problem is that on clicking a button an animation plays after an delay. Now I need to play a sound on that click.
I have tried to use the ActionAnimator but i'm unable to provide any delay in playing the sound. I just need to play that sound after the same delay as the animation.
Can anybody help me with this.
Here is the code.
<MTSTimeElem Name="Openfdr" Type="Keyframe" On="0">
<Target Name="00_MESH_126" Property="rot_" Timeline="T1"/>
<Time> 0 1 2 3 4 5 6 7 8 9 </Time>
<Timeline Name="T1" Type="R3D"> * - - - - - - - - [0.000002 -0.000002 -49.999992] </Timeline>
<MTSTimeElem Name="Play_Sound" Type="ActionAnimator" >
<MTSJavaScript Func="PlayS()"/>
</MTSTimeElem>
</MTSTimeElem>
 
Reply With QuoteEdit or Delete MessageReport This Post
EnIgMaTiCScOrPioN
Member
Picture of e_phoenix13
Posted Hide Post
Hi Prashant !!

Any action in the action animator which is on the 'Zero th' second will not work since it is on the zero time. Your action animator should be on the same TIME FRAME as that of your animation. What I would suggest is, you should define a null action called <Noop/> and write the code as follows.

See the code below:


<MTSAction Name="Noop" />

<MTSTimeElem Name="Openfdr" Type="Keyframe" On="0">
    <Target Name="00_MESH_126" Property="rot_" Timeline="T1"/>

    <Time> 0 1 2 3 4 5 6 7 8 9 </Time>

    <Timeline Name="T1" Type="R3D"> - - - - - - - - * [0.000002 -0.000002 -49.999992] </Timeline>

    <MTSTimeElem Name="Play_Sound" Type="ActionAnimator" > 
              <Noop/> <Noop/> <Noop/> <Noop/> <Noop/> <Noop/> <Noop/> <Noop/> 
              <MTSJavaScript Func="PlayS()"/> 
              <Noop/> 
    </MTSTimeElem>
</MTSTimeElem>





You can see that the animation starts at 8 th second with an * (asterik) and ends at 9th second with a value.
Also in the Action Animator, we have put the null actions till 7th second and on the 8th second is the Sound Function.
Hence the sound function as well as the animation trigger on the same time frame (8th second).

Its a good practice to put null actions instead of hyphens or dashes in Action Animators.


Hope this helps.


Best Regards,

Anup
 
Posts: 557 | Location: India | Registered: February 12, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Dont forget that you cant use MTSJavaScript with the Developper license
 
Posts: 181 | Registered: January 24, 2003Reply With QuoteEdit or Delete MessageReport This Post
<PatrolKiwi>
Posted
Hi,

You might also consider other strategies. If this animation is not tied into a bunch of others, or if there are not other Timelines involved that you may have deleted from the example, I would recommend you consider posting a message with a delay. That message can then be picked up by an interactor and trigger the two actions at the same time.

eg.

<MTSAction Name="goforit" />
<MTSAssignProperty Target="MTSInstance.00_MESH_126::rot_" Value="0.000002 -0.000002 -49.999992" />
<MTSJavaScript Func="PlayS()"/>
</MTSAction>

<MTSInteractor Name="grabmessage" >
<MTSHandle Event="playnow" Action="goforit" />
</MTSInteractor>

<MTSInteractor Name="myInteractor" >
<Target Name="someMESH" />
<MTSHandle Event="MouseLeftClick" Action="PostMessage" Message="playnow" Delay="9" />
</MTSInteractor>
 
Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 

Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  Viewpoint XML Schema    I need to dalay a ActionAnimator