Hacker News new | past | comments | ask | show | jobs | submit login

This is fun.

Try drawing programmatically:

  tools[7].paint(ctx, x, y);
then run:

  $canvas.trigger('change.session-hook');
to flush your canvas changes to the server.



To do it "properly", wrap it in `undoable`, then you don't need use `trigger`, and you can undo it normally. :)

    undoable(function(){
        for(var i = 0; i < 1; i += 1/10000){
            var angle = i * 500;
            var dist = i * 2;
            var x = canvas.width * (1/2 + Math.cos(angle) * dist);
            var y = canvas.height * (1/2 + Math.sin(angle) * dist);
            tools[7].paint(ctx, x, y);
        }
    });




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: