You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/index.html
+32-9Lines changed: 32 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -183,15 +183,38 @@ <h3>Spring physics</h3>
183
183
</ul>
184
184
</section>
185
185
<sectionid="advanced">
186
-
<h2>Advanced concepts</h2>
187
-
<p>This section describes some of the more advanced usages.</p>
188
-
189
-
<h3>Value feeding</h3>
190
-
<p>The animation object is very simple to work with but has it limitations. Sometimes you want to do the transforms in an other order.</p>
191
-
</section>
192
-
<footer>
193
-
Made by Daniel Lundin
194
-
</footer>
186
+
<h2>Advanced concepts</h2>
187
+
<p>This section describes some of the more advanced usages.</p>
188
+
189
+
<h3>Value feeding</h3>
190
+
<p>The animation object is very simple to work with but has it limitations. Sometimes you want to do the transforms in another order. This is where value feeding comes handy. The <em>value_feeder</em> expects a function that takes one parameter which will progress from 0 to 1. Every time it is called you should return a snabbtjs.matrix representing the current transform.</p>
191
+
<h4>Example:</h4>
192
+
<pre><code>snabbt(element, {
193
+
value_feeder: function(i) {
194
+
var y = 50*Math.sin(i*4*Math.PI);
195
+
var x = Math.sin(i*Math.PI);
196
+
return snabbtjs.mult(snabbtjs.scale(1+x, 1+x), snabbtjs.trans(x*400, y, 0));
0 commit comments