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

📄 animationcontroller.html

📁 J2ME Mobile3D API,高性能手机3D开发的api
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Nov 27 13:54:33 EET 2003 -->
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>
AnimationController (Mobile 3D Graphics API (M3G))
</TITLE>
<META NAME="keywords" CONTENT="javax.microedition.m3g.AnimationController,AnimationController class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title="AnimationController (Mobile 3D Graphics API (M3G))";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/AnimationController.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<EM><B>Nov 19, 2003</B></EM></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../javax/microedition/m3g/AnimationTrack.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="AnimationController.html" TARGET="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT>  <!--  if(window==top) {    document.writeln('<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT><A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A></NOSCRIPT></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.microedition.m3g</FONT>
<BR>
Class AnimationController</H2>
<PRE>
java.lang.Object
  |
  +--<A HREF="../../../javax/microedition/m3g/Object3D.html">javax.microedition.m3g.Object3D</A>
        |
        +--<B>javax.microedition.m3g.AnimationController</B>
</PRE>
<HR>
<DL>
<DT>public class <B>AnimationController</B><DT>extends <A HREF="../../../javax/microedition/m3g/Object3D.html">Object3D</A></DL>

<P>
<p>Controls the position, speed and weight of an animation sequence.</p><p>In anything other than the simplest scenes, an animation sequencewill require control of more than one property of more than one object.For example, a jointed figure performing a single gesture is usuallythought of as a single animation, yet it involves the coordinatedcontrol of the position and orientation of many different objects.</p><p>We define an <i>animation sequence</i> to mean a set of individualAnimationTracks that are controlled by a single AnimationController.Each AnimationTrack object contains all the data required to controla single animatable property on one target object.</p><p>An AnimationController object enables its associated animationsequence as a whole to be paused, stopped, restarted, fast-forwarded,rewound, arbitrarily repositioned, or deactivated. More formally, itdefines a linear mapping from world time to sequence time.</p><p>The detailed behaviour of how the data flows through the animationsystem as a whole is documented in the <A HREF="../../../javax/microedition/m3g/AnimationTrack.html"><CODE>AnimationTrack</CODE></A> class.</p><H3>Animation application</H3><p>In both immediate and retained mode, animations are explicitly appliedto target objects by calling the <code>animate</code> method on the targetObject3D itself. This re-evaluates the values of all object properties thathave one or more animations attached. Animations are also applied to thechildren of the target object, so the application is free to choosebetween calling <code>myWorld.animate</code> to animate everything in<code>myWorld</code> at once, or applying animations to more fine-grainedgroups of objects individually.</p><p>Animation controllers have an active interval, specified by minimumand maximum world time values, during which the animation controlleris active. Animations controlled by inactive animation controllershave no effect on their target objects and are simply ignored duringanimation application.</p><H3>Animation weighting</H3><p>Each animation controller has a <i>weight</i> associated withit. The contributions of all active animations targeting the sameproperty at the same time are blended together by their respectiveweights. Formally, the value of a scalar property P as a function ofweights w<sub>i</sub> and contributions P<sub>i</sub> is:</p><blockquote>P = sum [ w<sub>i</sub> P<sub>i</sub> ]</blockquote><p>For vector-valued properties, the above formula is applied for eachvector component separately. For most types of animation, the simpleweighted sum as shown above is sufficient, but for orientation valuesthe implementation is required to normalize the resulting quaternion.</p><H3>Timing and speed control</H3><p>AnimationController specifies a linear mapping between <i>worldtime</i>, passed in to <code>Object3D.animate</code>, and <i>sequencetime</i> that is used in sampling the associated keyframe data.</p><p>The sequence time is calculated directly from the given world timeat each call to <code>animate</code>, instead of storing it internally.This is to avoid undesirable accumulation of rounding errors and anyartifacts potentially resulting from that. It also simplifies the usageof the animation system by making it effectively stateless (as opposedto a traditional state machine design).</p><p>The mapping from world time to sequence time is parameterized bythree constants, specified in AnimationController, and one variable,the world time, that is passed in to <code>animate</code>. The formulafor calculating the sequence time t<sub>s</sub> corresponding to agiven world time t<sub>w</sub> is:</p><blockquote>t<sub>s</sub> = t<sub>sref</sub> + s (t<sub>w</sub> - t<sub>wref</sub>)</blockquote><p>where</p><blockquote>t<sub>s</sub> = the computed sequence time<br>t<sub>w</sub> = the given world time<br>t<sub>sref</sub> = the reference sequence time<br>t<sub>wref</sub> = the reference world time<br>s = the speed; sequence time per world time<br></blockquote><p>The <i>reference point</i> (t<sub>wref</sub>, t<sub>sref</sub>) isspecified with the <code>setPosition</code> method and the speed withthe <code>setSpeed</code> method (note that setting the speed may alsochange the reference point).</p><p>Sequence time can be visualized, in a coordinate system where worldtime is on the horizontal and sequence time on the vertical axis, as aline having slope s and passing through the point (t<sub>wref</sub>,t<sub>sref</sub>).</p><p>As an example of the relationship between world time and sequencetime, imagine a world where the current time is 5000 millisecondssince the start. An animation was started (from 0 ms sequence time) at3000 ms, running at half speed. The animation was started 2000 ms ago,but because the speed is 0.5, the actual required sequence timet<sub>sref</sub> is 1000 ms.  Here, we would have t<sub>w</sub> = 5000ms, t<sub>wref</sub> = 3000 ms, t<sub>sref</sub> = 0 ms, and s = 0.5in the formula above.</p><p>Note that the unit of time is not explicitly specified anywhere inthe API or the file format. It is strongly recommended thatapplications and content creation tools express times in millisecondsby default. Arbitrary units can, however, be used in specificapplications if mandated by range or precision requirements.</p><h3>Synchronized animation</h3><p>We assume that synchronization of animation with other mediatypes is only based on the world time passed from the controllingapplication. No synchronization events or other mechanisms areprovided for this purpose. In the case of synchronizing animationto music, for example, the current elapsed time is often availabledirectly from the music player library.</p><H3>Example usage</H3><p>As an example of using animation, consider a case where we wanta light source to pulsate between red and green, moving along acurved path. In both immediate and retained mode, this involvescreating keyframe sequences and associating them with the lightnode, as illustrated in Example 1 below.</p><p>To apply the animation to the light object in our renderingloop, we must call the <code>animate</code> method, as shown inExample 2.</p><a NAME="Example"></a>
<P>

<P>
<DL>
<DT><B>See Also:</B><DD><a href="../../../file-format.html#AnimationController">Binary format</a>, <A HREF="../../../javax/microedition/m3g/AnimationTrack.html"><CODE>AnimationTrack</CODE></A>, <A HREF="../../../javax/microedition/m3g/KeyframeSequence.html"><CODE>KeyframeSequence</CODE></A>, <A HREF="../../../javax/microedition/m3g/Object3D.html"><CODE>Object3D</CODE></A><DT><b>Examples:</b><DD><div class="example_title">(1) Creating an animation.</div><pre class="example"> <span class="example_class">Light</span> light = <span class="example_reserved">new</span> <span class="example_class">Light</span>();	<span class="example_comment">// Create a light node</span> <span class="example_comment">// Load a motion path from a stream, assuming it's the first</span><span class="example_comment">// object there</span> <span class="example_class">Object</span>3D[] objects = <span class="example_class">Loader</span>.load(<span class="example_string">"http://www.ex.com/ex.m3g"</span>);<span class="example_class">KeyframeSequence</span> motion = (<span class="example_class">KeyframeSequence</span>) objects[0]; <span class="example_comment">// Create a color keyframe sequence, with keyframes at 0 ms</span><span class="example_comment">// and 500 ms, and a total duration of 1000 ms. The animate</span>

⌨️ 快捷键说明

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