I am creating a seismograph but the continuous line I am graphing starts to slow down as the table holding the sum of the acceleration vectors increases. How can I stop this slowing FPS?
-- Seismograph
-- Use this function to perform your initial setup
function setup()
x = {}
c =-2
setback=0
l=0
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(0, 255, 127, 255)
l = l + 1
-- This sets the line thickness
strokeWidth(5)
stroke(0, 0, 0, 255)
-- Do your drawing here
if(l%3==0)then
e=UserAcceleration.x+UserAcceleration.y+UserAcceleration.z
-- print(e*700)
c = c + 1
table.remove(x,0)
x[c]=e*700+HEIGHT/2
end
for i=0,c do
if(c>120)then
setback = setback -.02
--table.remove(x,0)
-- print(d)
end
line(i*9+setback,x[i-1],(i+1)*9+setback,x[i])
end
strokeWidth(1)
stroke(255, 255, 255, 255)
line(0,HEIGHT/2,WIDTH,HEIGHT/2)
end