Source

cappuccino-docs / cappuccino docs / cappuccino.org / learn / documentation / _c_p_animation_8j.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<!-- Mirrored from cappuccino.org/learn/documentation/_c_p_animation_8j.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:18:53 GMT -->
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Cappuccino API: AppKit/CPAnimation.j File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>AppKit/CPAnimation.j File Reference</h1>
<p><a href="_c_p_animation_8j_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="_c_p_animation_8j.html#a7b2a03cbc2fda6a7b904233f7acfed30">ACTUAL_FRAME_RATE</a> = 0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="_c_p_animation_8j.html#af8bd08a7d1a74172de6655f9f79def79">CPAnimationEaseIn</a> = 1</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">import&lt; Foundation/<a class="el" href="_c_p_document_controller_8j.html#a97d2365502de5016df38a9335cb22976">CPObject.j</a> &gt;<br class="typebreak"/>
 import <a class="el" href="class_c_a_media_timing_function.html">CAMediaTimingFunction</a> <br class="typebreak"/>
<a class="el" href="_c_p_document_controller_8j.html#a97d2365502de5016df38a9335cb22976">j</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="_c_p_animation_8j.html#aa2f7477139e633dd100ba52e473a1737">CPAnimationEaseInOut</a> = 0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="_c_p_animation_8j.html#afb80342d96f87d9edcd1e1d487a4f5d3">CPAnimationEaseOut</a> = 2</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="_c_p_animation_8j.html#a87528b5be07d4fdfb95c940f5cfcc949">CPAnimationLinear</a> = 3</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">var&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="_c_p_animation_8j.html#a3e7d6de9ccce171225fef8bbf3006cda">CubicBezierAtTime</a></td></tr>
</table>
<hr/><h2>Variable Documentation</h2>
<a class="anchor" id="a7b2a03cbc2fda6a7b904233f7acfed30"></a><!-- doxytag: member="CPAnimation.j::ACTUAL_FRAME_RATE" ref="a7b2a03cbc2fda6a7b904233f7acfed30" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_c_p_animation_8j.html#a7b2a03cbc2fda6a7b904233f7acfed30">ACTUAL_FRAME_RATE</a> = 0</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_c_p_animation_8j_source.html#l00049">49</a> of file <a class="el" href="_c_p_animation_8j_source.html">CPAnimation.j</a>.</p>

</div>
</div>
<a class="anchor" id="af8bd08a7d1a74172de6655f9f79def79"></a><!-- doxytag: member="CPAnimation.j::CPAnimationEaseIn" ref="af8bd08a7d1a74172de6655f9f79def79" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_c_p_animation_8j.html#af8bd08a7d1a74172de6655f9f79def79">CPAnimationEaseIn</a> = 1</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_c_p_animation_8j_source.html#l00037">37</a> of file <a class="el" href="_c_p_animation_8j_source.html">CPAnimation.j</a>.</p>

</div>
</div>
<a class="anchor" id="aa2f7477139e633dd100ba52e473a1737"></a><!-- doxytag: member="CPAnimation.j::CPAnimationEaseInOut" ref="aa2f7477139e633dd100ba52e473a1737" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">import&lt;Foundation/<a class="el" href="_c_p_document_controller_8j.html#a97d2365502de5016df38a9335cb22976">CPObject.j</a>&gt; import <a class="el" href="class_c_a_media_timing_function.html">CAMediaTimingFunction</a> <a class="el" href="_c_p_document_controller_8j.html#a97d2365502de5016df38a9335cb22976">j</a> <a class="el" href="_c_p_animation_8j.html#aa2f7477139e633dd100ba52e473a1737">CPAnimationEaseInOut</a> = 0</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_c_p_animation_8j_source.html#l00032">32</a> of file <a class="el" href="_c_p_animation_8j_source.html">CPAnimation.j</a>.</p>

</div>
</div>
<a class="anchor" id="afb80342d96f87d9edcd1e1d487a4f5d3"></a><!-- doxytag: member="CPAnimation.j::CPAnimationEaseOut" ref="afb80342d96f87d9edcd1e1d487a4f5d3" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_c_p_animation_8j.html#afb80342d96f87d9edcd1e1d487a4f5d3">CPAnimationEaseOut</a> = 2</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_c_p_animation_8j_source.html#l00042">42</a> of file <a class="el" href="_c_p_animation_8j_source.html">CPAnimation.j</a>.</p>

</div>
</div>
<a class="anchor" id="a87528b5be07d4fdfb95c940f5cfcc949"></a><!-- doxytag: member="CPAnimation.j::CPAnimationLinear" ref="a87528b5be07d4fdfb95c940f5cfcc949" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_c_p_animation_8j.html#a87528b5be07d4fdfb95c940f5cfcc949">CPAnimationLinear</a> = 3</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_c_p_animation_8j_source.html#l00047">47</a> of file <a class="el" href="_c_p_animation_8j_source.html">CPAnimation.j</a>.</p>

</div>
</div>
<a class="anchor" id="a3e7d6de9ccce171225fef8bbf3006cda"></a><!-- doxytag: member="CPAnimation.j::CubicBezierAtTime" ref="a3e7d6de9ccce171225fef8bbf3006cda" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">var <a class="el" href="_c_p_animation_8j.html#a3e7d6de9ccce171225fef8bbf3006cda">CubicBezierAtTime</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Initial value:</b><div class="fragment"><pre class="fragment"> function <a class="code" href="_c_p_animation_8j.html#a3e7d6de9ccce171225fef8bbf3006cda">CubicBezierAtTime</a>(t,p1x,p1y,p2x,p2y,duration)
{
    var ax=0,bx=0,cx=0,ay=0,by=0,cy=0;
    
    function sampleCurveX(t) {<span class="keywordflow">return</span> ((ax*t+bx)*t+cx)*t;};
    function sampleCurveY(t) {<span class="keywordflow">return</span> ((ay*t+by)*t+cy)*t;};
    function sampleCurveDerivativeX(t) {<span class="keywordflow">return</span> (3.0*ax*t+2.0*bx)*t+cx;};
    
    function solveEpsilon(duration) {<span class="keywordflow">return</span> 1.0/(200.0*duration);};
    function solve(x,epsilon) {<span class="keywordflow">return</span> sampleCurveY(solveCurveX(x,epsilon));};
    
    function solveCurveX(x,epsilon) {var t0,t1,t2,x2,d2,i;
        function fabs(n) {<span class="keywordflow">if</span>(n&gt;=0) {<span class="keywordflow">return</span> n;}<span class="keywordflow">else</span> {<span class="keywordflow">return</span> 0-n;}}; 
        
        <span class="keywordflow">for</span>(t2=x, i=0; i&lt;8; i++) {x2=sampleCurveX(t2)-x; <span class="keywordflow">if</span>(fabs(x2)&lt;epsilon) {<span class="keywordflow">return</span> t2;} d2=sampleCurveDerivativeX(t2); <span class="keywordflow">if</span>(fabs(d2)&lt;1e-6) {<span class="keywordflow">break</span>;} t2=t2-x2/d2;}
        
        t0=0.0; t1=1.0; t2=x; <span class="keywordflow">if</span>(t2&lt;t0) {<span class="keywordflow">return</span> t0;} <span class="keywordflow">if</span>(t2&gt;t1) {<span class="keywordflow">return</span> t1;}
        <span class="keywordflow">while</span>(t0&lt;t1) {x2=sampleCurveX(t2); <span class="keywordflow">if</span>(fabs(x2-x)&lt;epsilon) {<span class="keywordflow">return</span> t2;} <span class="keywordflow">if</span>(x&gt;x2) {t0=t2;}<span class="keywordflow">else</span> {t1=t2;} t2=(t1-t0)*.5+t0;}
        <span class="keywordflow">return</span> t2; 
    };
    
    cx=3.0*p1x; bx=3.0*(p2x-p1x)-cx; ax=1.0-cx-bx; cy=3.0*p1y; by=3.0*(p2y-p1y)-cy; ay=1.0-cy-by;
    
    <span class="keywordflow">return</span> solve(t, solveEpsilon(duration));
}
</pre></div>
<p>Definition at line <a class="el" href="_c_p_animation_8j_source.html#l00323">323</a> of file <a class="el" href="_c_p_animation_8j_source.html">CPAnimation.j</a>.</p>

</div>
</div>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Tue Apr 6 10:32:59 2010 for Cappuccino API by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>

<!-- Mirrored from cappuccino.org/learn/documentation/_c_p_animation_8j.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:18:53 GMT -->
</html>