Skip to content

Commit

Permalink
tween
Browse files Browse the repository at this point in the history
  • Loading branch information
byteface committed Apr 17, 2021
1 parent de5adb5 commit 523bdf3
Show file tree
Hide file tree
Showing 51 changed files with 1,318 additions and 237 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,19 @@ All tags extend 'Node' and 'tag'. So will have DOM and magic methods available t
print(mysvg)
```

### Tweening

You can tween values with the tween library:

```python
from domonic.lerpy.easing import *
from domonic.lerpy.tween import *

someObj = {'x':0,'y':0,'z':0}
twn = Tween( someObj, { 'x':10, 'y':5, 'z':3 }, 6, Linear.easeIn )
twn.start()
```

### terminal (NEW)

There is a command line package that can call bash/unix/posix and other apps on the command line: <br />
Expand Down
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/packages/Tween.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/packages/autodocs.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/packages/dom.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 455cf04157247e0fa420516130392f8a
config: 0a21249f1709cfbc9d84172b987e1aca
tags: 645f666f9bcd5a90fca523b33c5a78b7
5 changes: 3 additions & 2 deletions docs/_build/html/_modules/domonic/CDN.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>domonic.CDN &#8212; domonic 0.2.12 documentation</title>
<title>domonic.CDN &#8212; domonic 0.2.13 documentation</title>
<link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
Expand Down Expand Up @@ -168,6 +168,7 @@ <h3>Navigation</h3>
<li class="toctree-l1"><a class="reference internal" href="../../packages/terminal.html">Domonic: terminal</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/CDN.html">Domonic: CDN</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/components.html">Domonic: templates and components</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/tween.html">Domonic: tween</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/x3d.html">Domonic: x3d</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/autodocs.html">Domonic: autodocs</a></li>
</ul>
Expand Down Expand Up @@ -204,7 +205,7 @@ <h3 id="searchlabel">Quick search</h3>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2020, byteface.
&copy;2021, byteface.

</div>

Expand Down
5 changes: 3 additions & 2 deletions docs/_build/html/_modules/domonic/JSON.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>domonic.JSON &#8212; domonic 0.2.12 documentation</title>
<title>domonic.JSON &#8212; domonic 0.2.13 documentation</title>
<link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
Expand Down Expand Up @@ -263,6 +263,7 @@ <h3>Navigation</h3>
<li class="toctree-l1"><a class="reference internal" href="../../packages/terminal.html">Domonic: terminal</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/CDN.html">Domonic: CDN</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/components.html">Domonic: templates and components</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/tween.html">Domonic: tween</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/x3d.html">Domonic: x3d</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/autodocs.html">Domonic: autodocs</a></li>
</ul>
Expand Down Expand Up @@ -299,7 +300,7 @@ <h3 id="searchlabel">Quick search</h3>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2020, byteface.
&copy;2021, byteface.

</div>

Expand Down
5 changes: 3 additions & 2 deletions docs/_build/html/_modules/domonic/decorators.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>domonic.decorators &#8212; domonic 0.2.12 documentation</title>
<title>domonic.decorators &#8212; domonic 0.2.13 documentation</title>
<link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
Expand Down Expand Up @@ -175,6 +175,7 @@ <h3>Navigation</h3>
<li class="toctree-l1"><a class="reference internal" href="../../packages/terminal.html">Domonic: terminal</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/CDN.html">Domonic: CDN</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/components.html">Domonic: templates and components</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/tween.html">Domonic: tween</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/x3d.html">Domonic: x3d</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/autodocs.html">Domonic: autodocs</a></li>
</ul>
Expand Down Expand Up @@ -211,7 +212,7 @@ <h3 id="searchlabel">Quick search</h3>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2020, byteface.
&copy;2021, byteface.

</div>

Expand Down
5 changes: 3 additions & 2 deletions docs/_build/html/_modules/domonic/dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>domonic.dom &#8212; domonic 0.2.12 documentation</title>
<title>domonic.dom &#8212; domonic 0.2.13 documentation</title>
<link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
Expand Down Expand Up @@ -1394,6 +1394,7 @@ <h3>Navigation</h3>
<li class="toctree-l1"><a class="reference internal" href="../../packages/terminal.html">Domonic: terminal</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/CDN.html">Domonic: CDN</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/components.html">Domonic: templates and components</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/tween.html">Domonic: tween</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/x3d.html">Domonic: x3d</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/autodocs.html">Domonic: autodocs</a></li>
</ul>
Expand Down Expand Up @@ -1430,7 +1431,7 @@ <h3 id="searchlabel">Quick search</h3>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2020, byteface.
&copy;2021, byteface.

</div>

Expand Down
81 changes: 79 additions & 2 deletions docs/_build/html/_modules/domonic/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>domonic.events &#8212; domonic 0.2.12 documentation</title>
<title>domonic.events &#8212; domonic 0.2.13 documentation</title>
<link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
Expand Down Expand Up @@ -43,6 +43,53 @@ <h1>Source code for domonic.events</h1><div class="highlight"><pre>
<span class="kn">import</span> <span class="nn">time</span>


<div class="viewcode-block" id="EventDispatcher"><a class="viewcode-back" href="../../packages/dom.html#domonic.events.EventDispatcher">[docs]</a><span class="k">class</span> <span class="nc">EventDispatcher</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; EventDispatcher is a class you can extend to give your obj event dispatching abilities &quot;&quot;&quot;</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">listeners</span> <span class="o">=</span> <span class="p">{}</span>

<span class="k">def</span> <span class="nf">hasEventListener</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_type</span><span class="p">):</span>
<span class="k">return</span> <span class="n">_type</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">listeners</span>

<span class="c1"># TODO - event: str, function, useCapture: bool</span>
<span class="c1"># def addEventListener(self, event: str, function, useCapture: bool) -&gt; None:</span>
<span class="k">def</span> <span class="nf">addEventListener</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_type</span><span class="p">,</span> <span class="n">callback</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="k">if</span> <span class="n">_type</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">listeners</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">listeners</span><span class="p">[</span><span class="n">_type</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">listeners</span><span class="p">[</span><span class="n">_type</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">callback</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">removeEventListener</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_type</span><span class="p">,</span> <span class="n">callback</span><span class="p">):</span>
<span class="k">if</span> <span class="n">_type</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">listeners</span><span class="p">:</span>
<span class="k">return</span>

<span class="n">stack</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">listeners</span><span class="p">[</span><span class="n">_type</span><span class="p">]</span>

<span class="k">for</span> <span class="n">thing</span> <span class="ow">in</span> <span class="n">stack</span><span class="p">:</span>
<span class="k">if</span> <span class="n">thing</span> <span class="o">==</span> <span class="n">callback</span><span class="p">:</span>
<span class="n">stack</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">thing</span><span class="p">)</span>
<span class="k">return</span>

<span class="k">def</span> <span class="nf">dispatchEvent</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
<span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">type</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">listeners</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">True</span> <span class="c1"># huh?. surely false?</span>

<span class="n">stack</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">listeners</span><span class="p">[</span><span class="n">event</span><span class="o">.</span><span class="n">type</span><span class="p">]</span>
<span class="c1"># .slice()</span>
<span class="n">event</span><span class="o">.</span><span class="n">target</span> <span class="o">=</span> <span class="bp">self</span> <span class="c1"># TODO/NOTE - is this correct? - cant think where else would set it</span>

<span class="k">for</span> <span class="n">thing</span> <span class="ow">in</span> <span class="n">stack</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">thing</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
<span class="c1"># type(thing, (Event,), self)</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">e</span><span class="p">)</span>
<span class="n">thing</span><span class="p">()</span> <span class="c1"># try calling without params, user may not create param</span>

<span class="k">return</span> <span class="ow">not</span> <span class="n">event</span><span class="o">.</span><span class="n">defaultPrevented</span></div>



<div class="viewcode-block" id="Event"><a class="viewcode-back" href="../../packages/dom.html#domonic.events.Event">[docs]</a><span class="k">class</span> <span class="nc">Event</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; event &quot;&quot;&quot;</span>
<span class="n">EMPTIED</span> <span class="o">=</span> <span class="s2">&quot;onemptied&quot;</span>
Expand Down Expand Up @@ -393,6 +440,35 @@ <h1>Source code for domonic.events</h1><div class="highlight"><pre>

<span class="k">def</span> <span class="nf">initCustomEvent</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">pass</span></div>


<div class="viewcode-block" id="TweenEvent"><a class="viewcode-back" href="../../packages/dom.html#domonic.events.TweenEvent">[docs]</a><span class="k">class</span> <span class="nc">TweenEvent</span><span class="p">(</span><span class="n">Event</span><span class="p">):</span>

<span class="n">START</span> <span class="o">=</span> <span class="s2">&quot;onStart&quot;</span>
<span class="n">STOP</span> <span class="o">=</span> <span class="s2">&quot;onStop&quot;</span>
<span class="n">RESET</span> <span class="o">=</span> <span class="s2">&quot;onReset&quot;</span>
<span class="n">PAUSE</span> <span class="o">=</span> <span class="s2">&quot;onPause&quot;</span>
<span class="n">UNPAUSE</span> <span class="o">=</span> <span class="s2">&quot;onUnPause&quot;</span>
<span class="n">UPDATE_START</span> <span class="o">=</span> <span class="s2">&quot;onUpdateStart&quot;</span>
<span class="n">UPDATE_END</span> <span class="o">=</span> <span class="s2">&quot;onUpdateEnd&quot;</span>
<span class="n">COMPLETE</span> <span class="o">=</span> <span class="s2">&quot;onComplete&quot;</span>

<span class="n">TIMER</span> <span class="o">=</span> <span class="s2">&quot;onTimer&quot;</span>

<span class="n">_source</span> <span class="o">=</span> <span class="kc">None</span>

<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">source</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span>

<span class="nd">@source</span><span class="o">.</span><span class="n">setter</span>
<span class="k">def</span> <span class="nf">source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_source</span> <span class="o">=</span> <span class="n">source</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_type</span><span class="p">,</span> <span class="n">source</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">bubbles</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">cancelable</span> <span class="o">=</span> <span class="kc">False</span><span class="p">):</span>
<span class="c1"># super.__init__(self, type, bubbles, cancelable)</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">_type</span><span class="p">)</span> <span class="c1"># TODO -</span>
<span class="bp">self</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">source</span></div>
</pre></div>

</div>
Expand Down Expand Up @@ -426,6 +502,7 @@ <h3>Navigation</h3>
<li class="toctree-l1"><a class="reference internal" href="../../packages/terminal.html">Domonic: terminal</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/CDN.html">Domonic: CDN</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/components.html">Domonic: templates and components</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/tween.html">Domonic: tween</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/x3d.html">Domonic: x3d</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/autodocs.html">Domonic: autodocs</a></li>
</ul>
Expand Down Expand Up @@ -462,7 +539,7 @@ <h3 id="searchlabel">Quick search</h3>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2020, byteface.
&copy;2021, byteface.

</div>

Expand Down
5 changes: 3 additions & 2 deletions docs/_build/html/_modules/domonic/html.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>domonic.html &#8212; domonic 0.2.12 documentation</title>
<title>domonic.html &#8212; domonic 0.2.13 documentation</title>
<link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
Expand Down Expand Up @@ -443,6 +443,7 @@ <h3>Navigation</h3>
<li class="toctree-l1"><a class="reference internal" href="../../packages/terminal.html">Domonic: terminal</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/CDN.html">Domonic: CDN</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/components.html">Domonic: templates and components</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/tween.html">Domonic: tween</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/x3d.html">Domonic: x3d</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../packages/autodocs.html">Domonic: autodocs</a></li>
</ul>
Expand Down Expand Up @@ -479,7 +480,7 @@ <h3 id="searchlabel">Quick search</h3>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2020, byteface.
&copy;2021, byteface.

</div>

Expand Down
Loading

0 comments on commit 523bdf3

Please sign in to comment.