renderd7/main/doc/html/namespaceTweenEngine.html

114 lines
7.7 KiB
HTML
Raw Normal View History

2021-07-24 23:48:15 +02:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Renderd7-nightly: TweenEngine Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Renderd7-nightly
&#160;<span id="projectnumber">v0.7.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('namespaceTweenEngine.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">TweenEngine Namespace Reference</div> </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>BaseTween is the base class of Tween and Timeline. It defines the iteration engine used to play animations for any number of times, and in any direction, at any speed. </p>
<p>It is responsible for calling the different callbacks at the right moments, and for making sure that every callbacks are triggered, even if the update engine gets a big delta time at once.</p>
<dl class="section see"><dt>See also</dt><dd>Tween </dd>
<dd>
Timeline </dd></dl>
<dl class="section author"><dt>Author</dt><dd>Aurelien Ribon | <a href="http://www.aurelienribon.com/">http://www.aurelienribon.com/</a></dd></dl>
<p>A light pool of objects that can be resused to avoid allocation. Based on Nathan Sweet pool implementation</p>
<p>Base class for every easing equation. You can create your own equations and directly use them in the Tween engine by inheriting from this class.</p>
<dl class="section see"><dt>See also</dt><dd>Tween </dd></dl>
<dl class="section author"><dt>Author</dt><dd>Aurelien Ribon | <a href="http://www.aurelienribon.com/">http://www.aurelienribon.com/</a></dd></dl>
<p>A TweenManager updates all your tweens and timelines at once. Its main interest is that it handles the tween/timeline life-cycles for you, as well as the pooling constraints (if object pooling is enabled). </p>
<p>Just give it a bunch of tweens or timelines and call update() periodically, you don't need to care for anything else! Relax and enjoy your animations.</p>
<dl class="section see"><dt>See also</dt><dd>Tween </dd>
<dd>
Timeline </dd></dl>
<dl class="section author"><dt>Author</dt><dd>Aurelien Ribon | <a href="http://www.aurelienribon.com/">http://www.aurelienribon.com/</a></dd></dl>
<p>Base class for every paths. You can create your own paths and directly use them in the Tween engine by inheriting from this class.</p>
<dl class="section author"><dt>Author</dt><dd>Aurelien Ribon | <a href="http://www.aurelienribon.com/">http://www.aurelienribon.com/</a></dd></dl>
<p>Easing equation based on Robert Penner's work: <a href="http://robertpenner.com/easing/">http://robertpenner.com/easing/</a> </p><dl class="section author"><dt>Author</dt><dd>Aurelien Ribon | <a href="http://www.aurelienribon.com/">http://www.aurelienribon.com/</a></dd></dl>
<p>Core class of the Tween Engine. A Tween is basically an interpolation between two values of an object attribute. However, the main interest of a Tween is that you can apply an easing formula on this interpolation, in order to smooth the transitions or to achieve cool effects like springs or bounces. </p>
<p>The Universal Tween Engine is called "universal" because it is able to apply interpolations on every attribute from every possible object. Therefore, every object in your application can be animated with cool effects: it does not matter if your application is a game, a desktop interface or even a console program! If it makes sense to animate something, then it can be animated through this engine. </p>
<p>This class contains many static factory methods to create and instantiate new interpolations easily. The common way to create a Tween is by using one of these factories: </p>
<ul>
<li>Tween.to(...)<br />
</li>
<li>Tween.from(...)<br />
</li>
<li>Tween.set(...)<br />
</li>
<li>Tween.call(...) </li>
</ul>
<h2>Example - firing a Tween</h2>
<p>The following example will move the target horizontal position from its current value to x=200 and y=300, during 500ms, but only after a delay of 1000ms. The animation will also be repeated 2 times (the starting position is registered at the end of the delay, so the animation will automatically restart from this registered position). </p>
<pre><div class="fragment"><div class="line">Tween.to(myObject, POSITION_XY, 0.5f)</div>
<div class="line"> .target(200, 300)</div>
<div class="line"> .ease(Quad.INOUT)</div>
<div class="line"> .delay(1.0f)</div>
<div class="line"> .repeat(2, 0.2f)</div>
<div class="line"> .start(myManager);</div>
</div><!-- fragment --> </pre><p>Tween life-cycles can be automatically managed for you, thanks to the <a class="el" href="">TweenManager</a> class. If you choose to manage your tween when you start it, then you don't need to care about it anymore. <b>Tweens are <em>fire-and-forget</em>: don't think about them anymore once you started them (if they are managed of course).</b> </p>
<p>You need to periodicaly update the tween engine, in order to compute the new values. If your tweens are managed, only update the manager; else you need to call <a class="el" href="">update()</a> on your tweens periodically. </p>
<h2>Example - setting up the engine</h2>
<p>The engine cannot directly change your objects attributes, since it doesn't know them. Therefore, you need to tell him how to get and set the different attributes of your objects: <b>you need to implement the {<a class="el" href="">} interface for each object class you will animate. Once done, don't forget to register these implementations, using the static method registerAccessor()}, when you start your application. TweenAccessor TweenManager TweenEquation Timeline Aurelien Ribon | <a href="http://www.aurelienribon.com/">http://www.aurelienribon.com/</a> </a></b></p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="namespaceTweenEngine.html">TweenEngine</a></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
</ul>
</div>
</body>
</html>