📄 animationcontroller.html
字号:
<span class="example_comment">// method will throw an exception if it encounters a</span><span class="example_comment">// KeyframeSequence whose duration has not been set or whose</span><span class="example_comment">// keyframes are out of order. Note that the Loader</span><span class="example_comment">// automatically validates any sequences that are loaded from</span><span class="example_comment">// a file.</span> <span class="example_class">KeyframeSequence</span> blinking = <span class="example_reserved">new</span> <span class="example_class">KeyframeSequence</span>(2, 3, <span class="example_class">KeyframeSequence</span>.<span class="example_constant">LINEAR</span>);blinking.setKeyframe(0, 0, <span class="example_reserved">new</span> <span class="example_type">float</span>[] { 1.0f, 0.0f, 0.0f });blinking.setKeyframe(1, 500, <span class="example_reserved">new</span> <span class="example_type">float</span>[] { 0.0f, 1.0f, 0.0f });blinking.setDuration(1000); <span class="example_class">AnimationTrack</span> blink = <span class="example_reserved">new</span> <span class="example_class">AnimationTrack</span>(blinking, <span class="example_class">AnimationTrack</span>.<span class="example_constant">COLOR</span>);<span class="example_class">AnimationTrack</span> move = <span class="example_reserved">new</span> <span class="example_class">AnimationTrack</span>(motion, <span class="example_class">AnimationTrack</span>.<span class="example_constant">TRANSLATION</span>);light.addAnimationTrack(blink);light.addAnimationTrack(move); <span class="example_comment">// Create an AnimationController and make it control both the</span><span class="example_comment">// blinking and the movement of our light</span> <span class="example_class">AnimationController</span> lightAnim = <span class="example_reserved">new</span> <span class="example_class">AnimationController</span>();blink.setController(lightAnim);move.setController(lightAnim); <span class="example_comment">// Start the animation when world time reaches 2 seconds, stop</span><span class="example_comment">// at 5 s. There is only one reference point for this</span><span class="example_comment">// animation: sequence time must be zero at world time 2000</span><span class="example_comment">// ms. The animation will be running at normal speed (1.0, the</span><span class="example_comment">// default).</span> lightAnim.setActiveInterval(2000, 5000);lightAnim.setPosition(0, 2000);</pre><div class="example_title">(2) Applying the animation during rendering.</div><pre class="example"> appTime += 30; <span class="example_comment">// advance time by 30 ms each frame</span>light.animate(appTime); <span class="example_comment">// Assume 'myGraphics3D' is the Graphics3D object we draw into.</span><span class="example_comment">// In immediate mode, node transforms are ignored, so we get</span><span class="example_comment">// our animated transformation into a local Transform object,</span><span class="example_comment">// "lightToWorld". As its name implies, the transformation is</span><span class="example_comment">// from the Light node's local coordinates to world space.</span> light.getTransform(lightToWorld);myGraphics3D.resetLights();myGraphics3D.addLight(light, lightToWorld);</pre></DD></DD></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/AnimationController.html#AnimationController()">AnimationController</A></B>()</CODE>
<BR>
Creates a new AnimationController object. </TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/AnimationController.html#getActiveIntervalEnd()">getActiveIntervalEnd</A></B>()</CODE>
<BR>
Retrieves the ending time of the current active interval of this animation controller, in world time units. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/AnimationController.html#getActiveIntervalStart()">getActiveIntervalStart</A></B>()</CODE>
<BR>
Retrieves the starting time of the current active interval of this animation controller, in world time units. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/AnimationController.html#getPosition(int)">getPosition</A></B>(int worldTime)</CODE>
<BR>
Retrieves the sequence time that corresponds to the given world time. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/AnimationController.html#getSpeed()">getSpeed</A></B>()</CODE>
<BR>
Retrieves the currently set playback speed of this animation controller.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/AnimationController.html#getWeight()">getWeight</A></B>()</CODE>
<BR>
Retrieves the currently set blending weight for this animation controller.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/AnimationController.html#setActiveInterval(int, int)">setActiveInterval</A></B>(int start, int end)</CODE>
<BR>
Sets the world time interval during which this animation controller is active.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/AnimationController.html#setPosition(float, int)">setPosition</A></B>(float sequenceTime, int worldTime)</CODE>
<BR>
Sets a new playback position, relative to world time, for this animation controller. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/AnimationController.html#setSpeed(float, int)">setSpeed</A></B>(float speed, int worldTime)</CODE>
<BR>
Sets a new playback speed for this animation. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/AnimationController.html#setWeight(float)">setWeight</A></B>(float weight)</CODE>
<BR>
Sets the blending weight for this animation controller. </TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_javax.microedition.m3g.Object3D"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class javax.microedition.m3g.<A HREF="../../../javax/microedition/m3g/Object3D.html">Object3D</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../javax/microedition/m3g/Object3D.html#addAnimationTrack(javax.microedition.m3g.AnimationTrack)">addAnimationTrack</A>, <A HREF="../../../javax/microedition/m3g/Object3D.html#animate(int)">animate</A>, <A HREF="../../../javax/microedition/m3g/Object3D.html#duplicate()">duplicate</A>, <A HREF="../../../javax/microedition/m3g/Object3D.html#find(int)">find</A>, <A HREF="../../../javax/microedition/m3g/Object3D.html#getAnimationTrack(int)">getAnimationTrack</A>, <A HREF="../../../javax/microedition/m3g/Object3D.html#getAnimationTrackCount()">getAnimationTrackCount</A>, <A HREF="../../../javax/microedition/m3g/Object3D.html#getReferences(javax.microedition.m3g.Object3D[])">getReferences</A>, <A HREF="../../../javax/microedition/m3g/Object3D.html#getUserID()">getUserID</A>, <A HREF="../../../javax/microedition/m3g/Object3D.html#getUserObject()">getUserObject</A>, <A HREF="../../../javax/microedition/m3g/Object3D.html#removeAnimationTrack(javax.microedition.m3g.AnimationTrack)">removeAnimationTrack</A>, <A HREF="../../../javax/microedition/m3g/Object3D.html#setUserID(int)">setUserID</A>, <A HREF="../../../javax/microedition/m3g/Object3D.html#setUserObject(java.lang.Object)">setUserObject</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="AnimationController()"><!-- --></A><H3>
AnimationController</H3>
<PRE>
public <B>AnimationController</B>()</PRE>
<DL>
<DD><p>Creates a new AnimationController object. The default values for the new object are:</p> <ul> <li>active interval: [0, 0) (always active)</li> <li>blending weight: 1.0</li> <li>speed: 1.0</li> <li>reference point: (0, 0)</li> </ul>
<P>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="setActiveInterval(int, int)"><!-- --></A><H3>
setActiveInterval</H3>
<PRE>
public void <B>setActiveInterval</B>(int start, int end)</PRE>
<DL>
<DD><p>Sets the world time interval during which this animation controller is active.</p> <p>This animation controller will subsequently be <i>active</i> when the world time t is such that <code>start <= t < end</code>, and inactive outside of that range. As a special case, if <code>start</code> and <code>end</code> are set to the same value, this animation controller is always active.</p> <p>Note that changing the active interval has no effect on the mapping from world time to sequence time.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>start</CODE> - the starting time of the active interval, in
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -