⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keyframesequence.html

📁 J2ME Mobile3D API,高性能手机3D开发的api
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/KeyframeSequence.html#setDuration(int)">setDuration</A></B>(int&nbsp;duration)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the duration of this sequence in sequence time units. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/KeyframeSequence.html#setKeyframe(int, int, float[])">setKeyframe</A></B>(int&nbsp;index,            int&nbsp;time,            float[]&nbsp;value)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the time position and value of the specified keyframe. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/KeyframeSequence.html#setRepeatMode(int)">setRepeatMode</A></B>(int&nbsp;mode)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the repeat mode of this KeyframeSequence. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/KeyframeSequence.html#setValidRange(int, int)">setValidRange</A></B>(int&nbsp;first,              int&nbsp;last)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Selects the range of keyframes that are included in the animation. </TD>
</TR>
</TABLE>
&nbsp;<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>
&nbsp;<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>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->

<A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="LINEAR"><!-- --></A><H3>
LINEAR</H3>
<PRE>
public static final int <B>LINEAR</B></PRE>
<DL>
<DD><p>A constructor parameter that specifies linear interpolation between keyframes.</p> <p>For a keyframe with value <b>v</b><sub>i</sub> at time t<sub>i</sub>, where the following keyframe has a value <b>v</b><sub>i+1</sub> at time t<sub>i+1</sub>, the interpolated value <b>v</b> is defined only for values of time t such that t<sub>i</sub> &lt;= t &lt; t<sub>i+1</sub>, as follows:</p> <blockquote> <b>v</b> = (1-s)<b>v</b><sub>i</sub> + s<b>v</b><sub>i+1</sub> </blockquote> <p>where s is an interpolation factor in [0, 1) computed from the keyframe times:</p>  <blockquote> s = (t - t<sub>i</sub>) / (t<sub>i+1</sub> - t<sub>i</sub>) </blockquote>
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.microedition.m3g.KeyframeSequence.LINEAR">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="SLERP"><!-- --></A><H3>
SLERP</H3>
<PRE>
public static final int <B>SLERP</B></PRE>
<DL>
<DD><p>A constructor parameter that specifies spherical linear interpolation of quaternions.</p> <p>This type of interpolation will interpolate at constant speed along the shortest "great circle" path between two keyframe orientations as represented on the surface of the hypersphere.</p> <p>Spherical linear interpolation between two keyframe values <b>q</b><sub>i</sub> and <b>q</b><sub>i+1</sub> is defined as:</p> <blockquote> slerp(s; <b>q</b><sub>i</sub>, <b>q</b><sub>i+1</sub>)     = (<b>q</b><sub>i</sub> sin((1-s)a)     + <b>q</b><sub>i+1</sub> sin(sa)) / sin(a) </blockquote> <p>where a is the angle between the two quaternions and s is the interpolation factor defined for <code>LINEAR</code> interpolation.</p>  <p>Note that interpolation between diametrically opposed orientations in successive keyframes is undefined. It is recommended that authoring tools should take steps to warn designers if this case is detected.</p>  <p>More details can be found in "Quaternion Algebra and Calculus" by David Eberly [see <a href="../../../overview-summary.html#Literature">Related Literature</a>].</p>
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.microedition.m3g.KeyframeSequence.SLERP">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="SPLINE"><!-- --></A><H3>
SPLINE</H3>
<PRE>
public static final int <B>SPLINE</B></PRE>
<DL>
<DD><p>A constructor parameter that specifies spline interpolation between keyframes. The keyframes will be interpolated with a Catmull-Rom spline adjusted to accommodate non-constant keyframe intervals.</p> <p>For each curve segment i, we have the values <b>v</b><sub>i</sub> at time t<sub>i</sub>, and <b>v</b><sub>i+1</sub> at time t<sub>i+1</sub>. We also define tangents at the end points of the segment: <b>T</b><sub>i</sub> at the start point, and <b>T</b><sub>i+1</sub> at the end point.</p> <p>Using the interpolation factor s defined for <code>LINEAR</code> interpolation, we can then express the interpolation of the curve as follows:</p> <blockquote> <table cellpadding="0" cellspacing="0"> <tr>  <td width="30" align="center"> <b>S</b> = </td> <td align="right"> | <code>s</code><sup><code>3</code></sup> |<br> | <code>s</code><sup><code>2</code></sup> |<br> | <code>s</code><sup><code>&nbsp;</code></sup> |<br> | <code>1</code><sup><code>&nbsp;</code></sup> |<br> </td> <td width="40"/>  <td width="30" align="center"> <b>H</b> = </td> <td align="right"> <code>| &nbsp;2      -2 &nbsp;1 &nbsp;1 &nbsp;|</code><br> <code>|      -3 &nbsp;3      -2      -1 &nbsp;|</code><br> <code>| &nbsp;0 &nbsp;0 &nbsp;1 &nbsp;0 &nbsp;|</code><br> <code>| &nbsp;1 &nbsp;0 &nbsp;0 &nbsp;0 &nbsp;|</code><br> </td> <td width="40"/> <td width="30" align="center"> <b>C</b> = </td> <td align="right"> | <code><b>v</b></code><sub><code>i &nbsp;&nbsp;</code></sub> |<br> | <code><b>v</b></code><sub><code>i+1&nbsp;</code></sub> |<br> | <code><b>T</b></code><sup><code>0</code></sup><sub><code>i &nbsp;</code></sub> |<br> | <code><b>T</b></code><sup><code>1</code></sup><sub><code>i+1</code></sub> |<br> </td> </tr>  </table> </blockquote>  <p>The value <b>v</b><sub>s</sub> of the curve at position s can be calculated using the formula:</p> <blockquote> <b>v</b><sub>s</sub> = <b>S</b><sup>T</sup> <b>H</b> <b>C</b> </blockquote> <p>The only thing left to define is the calculation of the tangent vectors <b>T</b><sup>{0,1}</sup><sub>i</sub>. A standard Catmull-Rom spline assumes that the keyframe values are evenly spaced in time, and calculates the tangents as centered finite differences of the adjacent keyframes:</p> <blockquote> <b>T</b><sub>i</sub> = (<b>v</b><sub>i+1</sub> -         <b>v</b><sub>i-1</sub>) / 2 </blockquote>  <p>We apply additional scaling values to compensate for irregular keyframe timing, and the final tangents are:</p> <blockquote> <b>T</b><sup>0</sup><sub>i</sub> =         <b>F<sup> +</sup></b><sub>i</sub> <b>T</b><sub>i</sub><br> <b>T</b><sup>1</sup><sub>i</sub> =         <b>F<sup> -</sup></b><sub>i</sub> <b>T</b><sub>i</sub> </blockquote> <p>where:</p> <blockquote> <b>F<sup> -</sup></b><sub>i</sub> = 2 (t<sub>i+1</sub> - t<sub>i</sub>)    / (t<sub>i+1</sub> - t<sub>i-1</sub>)<br> <b>F<sup> +</sup></b><sub>i</sub> = 2 (t<sub>i</sub> - t<sub>i-1</sub>)    / (t<sub>i+1</sub> - t<sub>i-1</sub>)<br> <b>F<sup> -</sup></b><sub>0</sub> =    <b>F<sup> +</sup></b><sub>0</sub> =    <b>F<sup> -</sup></b><sub>N-1</sub> =    <b>F<sup> +</sup></b><sub>N-1</sub> = 0,    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in a <code>CONSTANT</code>    sequence </blockquote>  <p>It is relatively easy to convert to this representation from piecewise Bezier splines (as used by 3ds max, for example) as long as the tangents are set up according to the above scheme. Conversion from other interpolating spline forms may not be exact, although any interpolating spline is guaranteed to pass through the keyframe values.</p>
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.microedition.m3g.KeyframeSequence.SPLINE">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="SQUAD"><!-- --></A><H3>
SQUAD</H3>
<PRE>
public static final int <B>SQUAD</B></PRE>
<DL>
<DD><p>A constructor parameter that specifies spline interpolation of quaternions.</p> <p>This interpolation method is similar to the <code>SPLINE</code> method, but using equivalent quaternion operations. The tangents for each keyframe are computed as centered finite differences, only this time via quaternion logarithms:</p> <blockquote> <b>T</b><sub>n</sub>   = ( log(<b>q</b><sub>i</sub><sup>-1</sup> <b>q</b><sub>i+1</sub>)   +  log(<b>q</b><sub>i-1</sub><sup>-1</sup> <b>q</b><sub>i</sub>)   ) / 2 </blockquote> <p>Note that the operations above are <em>not</em> to be confused with scalar or vector operations. The notation "<b>q</b><sup>-1</sup>" denotes the inverse of quaternion "<b>q</b>"; the multiplications are quaternion multiplications; and the logarithm is a quaternion logarithm, which essentially yields a 3-vector as a result.</p> <p>Again, keyframe tangents are scaled to compensate for irregular keyframe timing, yielding the final "outgoing" and "incoming" tangents:</p> <blockquote> <b>T</b><sup>0</sup><sub>i</sub> =         <b>F<sup> +</sup></b><sub>i</sub> <b>T</b><sub>i</sub><br> <b>T</b><sup>1</sup><sub>i</sub> =         <b>F<sup> -</sup></b><sub>i</sub> <b>T</b><sub>i</sub> </blockquote> <p>where <b>F<sup> +</sup></b><sub>i</sub> and <b>F<sup> -</sup></b><sub>i</sub> are the factors defined for <code>SPLINE</code> interpolation. The special end conditions for <code>CONSTANT</code> sequences also apply.</p> <p>From the scaled tangents, intermediate quaternion values <b>a</b> and <b>b</b> are computed for use in interpolating the curve segments starting and ending at each keyframe:</p> <blockquote> <b>a</b><sub>i</sub> = <b>q</b><sub>i</sub>   exp( (<b>T</b><sup>0</sup><sub>i</sub>   - log(<b>q</b><sub>i</sub><sup>-1</sup> <b>q</b><sub>i+1</sub>))   / 2 )<br> <b>b</b><sub>i</sub> = <b>q</b><sub>i</sub>   exp( (log(<b>q</b><sub>i-1</sub><sup>-1</sup> <b>q</b><sub>i</sub>)   - <b>T</b><sup>1</sup><sub>i</sub>)   / 2 ) </blockquote> <p>Finally, the interpolated value <b>q</b> at position s (as defined in <code>LINEAR</code>) for a curve segment between keyframes i and i + 1 is obtained by using <code>SLERP</code> interpolation, as follows:</p> <blockquote> <b>q</b> = slerp( 2s(1 - s);              slerp(s; <b>q</b><sub>i</sub>, <b>q</b><sub>i+1</sub>),              slerp(s; <b>a</b><sub>i</sub>, <b>b</b><sub>i+1</sub>) ) </blockquote> <p>For more information, refer to "Key Frame Interpolation via Splines and Quaternions" by David Eberly [see <a href= "../../../overview-summary.html#Literature">Related Literature</a>].</p>
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.microedition.m3g.KeyframeSequence.SQUAD">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="STEP"><!-- --></A><H3>
STEP</H3>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -