Forcing update with a function? (for previewing animation)

  • Would it be possible for DrawBot to re-run the script at a specified rate, similar to how Processing uses frameRate() to determine a target for how many times the sketch should refresh per second.

    Calling frameRate(4) could have DrawBot update at a rate of 4 times per second, and the global variable frame could be a counter that increments each update, so something like oval( sin(frame) * 100, 100, 100, 100) would draw an animated oval.

    This would be very useful for previewing an animation within DrawBot, without having to export to a gif or mov file.

  • admin

    It is always possible!!! maybe the easiest option is open a html view and place a generated gif...

    other options are: create a window with a nsview that is looping over all the pages of your generated pdf and draw each one

    Or if you wish it works similar like processing: create a "refreshing" loop in a nsview drawRect_ and call a callback each time.

    For now this is out of scope of DrawBot, Im sorry...

    If you simply wish to set frame rate use frameDuration() on every newly added page. see frameDuration.

    hope this helps!!

  • Thank you! This is very helpful. I will look into nsview and looping over the pages.

Log in to reply