uxebu / bonsai

BonsaiJS is a graphics library and renderer
http://bonsaijs.org
Other
1.96k stars 189 forks source link

New Signature For Stage.frames... #215

Closed iammerrick closed 6 years ago

iammerrick commented 11 years ago

I would like to propose overloading frames to support an addition signature. I would like the first argument to be the time, and the second to be the frame function... For example:

stage.frames('5s', function() {
  // The frame...
});

This would make scheduling dynamic frames much cleaner, currently if you want to dynamically schedule a frame in the future you have to create it as an object literal, for example:

function frame(time, fn) {
  var frame = {};
  frame[time] = fn;
  stage.frames(frame);
}

Thoughts on support this kind of signature directly in Bonsai?

M

basecode commented 11 years ago

Thb, it's not entirely clear to me why frames is supposed to add frames at all :) I would see it as a setter. Instead I would propose sth like addFrame(number or string, fn). /cc @davidaurelio