Performance issue on firefox [Processing with pure java script ]
in
Processing with Other Languages
•
9 months ago
Hi, All
I am modelling a simple demo, a rectangle following the mouse and the code attached.
I have a performance issue on firefox browser.
I found the demo which code with processing code running smoothly.
could anyone give me some suggestions on this, thanks.
- var sketchProc = function(processing){
- var p = processing, rectObj = {'x':0, 'y':0, 'width':50, 'height':50};
- p.mouseMoved = function(){
- rectObj['x'] = p.mouseX;
- rectObj['y'] = p.mouseY;
- p.redraw();
- };
- p.setup = function(){
- p.size(800, 600);
- p.noLoop();
- };
- p.draw = function(){
- var date = new Date();
- p.background(255);
- p.stroke(148);
- p.fill(0);
- p.rect(rectObj['x'],rectObj['y'], rectObj['width'],rectObj['height']);
- console.log('Draw time: ' + (date.getTime() - new Date().getTime()) )
- };
- }
- $(document).ready(function(){
- var canvas = document.getElementById("container");
- var p = new Processing(canvas, sketchProc);
- });
1