I just noticed that if you try animating an object with multiple
properties, the step function is called for every increment of every
property. Which wasn’t quite what I was expecting. I was kind of
expecting the step function to be called every time the entire object
was updated (ie. every step in time).

So, the question is – is there a neat way to detect, inside the step
function, when all the properties of an object have been updated, so
that you can trigger a callback on a 'per frame' rather than 'per
step' basis?

Here's a wee bit of code to illustrate the problem:

var one = {
  x: 0,
  y: 1
};
var two = {
  x: 1,
  y: 0
};

function update(){
  // This gets called on changes of x and of y!
  // Is there a good way to know that both
  // x and y have been changed, ie one whole
  // animation frame has taken place?
}

jQuery(one)
  .animate(two, {
    step: update
  });

Reply via email to