Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The solution for me was to instantiate the tween inside the <code>onFinish</code> function:</p> <pre><code>var waveScaleAnimation = new Kinetic.Tween({ node:waves, scaleY:newWaveScale, duration:waveScaleDuration, onFinish: function () { var reverseWaveScaleAnimation = new Kinetic.Tween({ node:waves, scaleY: 1, duration:waveScaleDuration, }); reverseWaveScaleAnimation.play(); } }); </code></pre> <p>See my example here: <a href="http://jsfiddle.net/projeqht/RzaXR/" rel="nofollow">jsfiddle</a></p> <p>An explanation for this could be that the original node is returning to it's original state before executing the <code>reverseWaveScaleAnimation</code> tween possibly because when you instantiate <code>reverseWaveScaleAnimation</code> outside, it expects the node in its original state. But if you instantiate the tween inside the <code>onFinish</code> function, then the tween expects the node at the state that it is in when the <code>waveScaleAnimation</code> tween is finished.</p> <p>Hopefully that makes sense as my explanation isn't very detailed, perhaps someone else might be able to provide more details about tweens as I don't use them often.</p> <p><strong>EDIT:</strong> Actually, that explains the scenario where you switch from tweening <code>scaleY</code> to <code>opacity</code>. I'm assuming that originally your node will start at <code>1.0 opacity</code> but when you tween it towards say <code>0.0 opacity</code>, the node originally started at <code>1.0 opacity</code> so there's no issues for the tween to start back at <code>1.0 opacity</code> and tween towards <code>0.0 opacity</code>. Thus, it <strong>seemed</strong> like the tween was working as intended <code>onFinish</code>, but really, it was doing the same as when you were tweening <code>scaleY</code>.</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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