Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem is that anim.start() is non-blocking. Instead of only returning after the animation is finished, it will return immediately and the animation will be executed concurrently. This means at the same time your function starts two animations <strong>and</strong> unlinks the node that should be animated.</p> <p>So instead you should use the end callbacks that can be given to the animations to trigger one step after another. The the blink function could then look like this:</p> <pre><code>def blink(self, node): pos = node.pos size = node.size covernode = avg.RectNode(pos=pos, size=size, fillopacity=0, parent = self._parentNode, fillcolor="ffffff", color="000000", strokewidth=2) fadeOutAnim = LinearAnim(covernode, 'fillopacity', 1000, 1, 0, False, None, covernode.unlink) fadInAnim= LinearAnim(covernode, 'fillopacity', 1000, 0, 1, False, None, fadeOutAnim.start) fadInAnim.start() </code></pre> <p>If you want the node to stay white for a certain amount of time you have to insert another step using either a WaitAnim or player.setTimeout(). (https://www.libavg.de/reference/current/player.html#libavg.avg.Player)</p> <pre><code>def blink(self, node): pos = node.pos size = node.size covernode = avg.RectNode(pos=pos, size=size, fillopacity=0, parent = self._parentNode, fillcolor="ffffff", color="000000", strokewidth=2) fadeOutAnim = LinearAnim(covernode, 'fillopacity', 1000, 1, 0, False, None, covernode.unlink ) fadInAnimObj = LinearAnim(covernode, 'fillopacity', 1000, 0, 1, False, None, lambda:self.wait(500, fadeOutAnim.start) ) fadInAnimObj.start() def wait(self, time, end_cb): avg.Player.get().setTimeout(time, end_cb) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload