efficient grid of points/dots

oh learnt something new today with parameter.integer() , I have not used that phrase before. With the sprite code , does that mean it makes a new sprite every frame, is that not going to eat resources?

Cheers YK

@archistudent It only creates a new sprite when you change the size with the parameter slider.

@archistudent The parameter.integer statement also has a callback option. Anytime the size changes when you move the slider, (in the below code), the function resize() gets called which recreates the sprite at the new size. After that, that new sprite gets called by draw and doesn’t change until you change the size again.


function setup()
    parameter.integer("size",5,55,25,resize)
end

function resize()
    ...
    ...
end

function draw()
    ...
    ...
end

Thanks everybody, I’ve managed to make the grid sprite rescale and retranslate base on an equation of distance moved/scaled. so it uses a sprite the size of the screen however you can scroll forever in all directions :slight_smile: It runs like a well oiled machine now, The use of setcontext was invaluable to this - Thanks everybody.

My next problem is completing the ‘upload to dropbox’ portion of the code. Will post the issues in another post.

Cheers
YK