mirror of
https://github.com/nature-of-code/noc-book-2
synced 2024-11-16 07:47:48 +01:00
Notion - Update docs
This commit is contained in:
parent
9a1106ab62
commit
2bc2ae2a9e
1 changed files with 20 additions and 4 deletions
|
@ -754,25 +754,41 @@ function draw() {
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1. A global function that receives both an <code>Attractor</code> and a <code>Mover</code>.</td>
|
||||
<td>
|
||||
<ol start="1">
|
||||
<li>A global function that receives both an <code>Attractor</code> and a <code>Mover</code>.</li>
|
||||
</ol>
|
||||
</td>
|
||||
<td>
|
||||
<pre><code>attraction(attractor, mover);</code></pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2. A method in the <code>Attractor</code> class that receives a <code>Mover</code>.</td>
|
||||
<td>
|
||||
<ol start="2">
|
||||
<li>A method in the <code>Attractor</code> class that receives a <code>Mover</code>.</li>
|
||||
</ol>
|
||||
</td>
|
||||
<td>
|
||||
<pre><code>attractor.attract(mover);</code></pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3. A method in the <code>Mover</code> class that receives an <code>Attractor</code>.</td>
|
||||
<td>
|
||||
<ol start="3">
|
||||
<li>A method in the <code>Mover</code> class that receives an <code>Attractor</code>.</li>
|
||||
</ol>
|
||||
</td>
|
||||
<td>
|
||||
<pre><code>mover.attractedTo(attractor);</code></pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>4. A method in the <code>Attractor</code> class that receives a <code>Mover</code> and returns a <code>p5.Vector</code>, which is the attraction force. That attraction force is then passed into the <code>Mover</code> object’s <code>applyForce()</code> method.</td>
|
||||
<td>
|
||||
<ol start="4">
|
||||
<li>A method in the <code>Attractor</code> class that receives a <code>Mover</code> and returns a <code>p5.Vector</code>, which is the attraction force. That attraction force is then passed into the <code>Mover</code> object’s <code>applyForce()</code> method.</li>
|
||||
</ol>
|
||||
</td>
|
||||
<td>
|
||||
<pre><code>let force = attractor.attract(mover);
|
||||
mover.applyForce(force);</code></pre>
|
||||
|
|
Loading…
Reference in a new issue