I’m working on an instrument and I’m trying to implement an animated background. I’ve tried doing this a number of ways and I’m hoping someone can nudge me in the right direction on how to achieve this.
Basically on initialization, I want the background to start animating. I have a 20 frame bitmap png file that I’m using. But so far I haven’t been able to get it to function. I’ve lost track of all my attempts and the last thing I’ve done is just try to use the Animation Script Template Example altering the script to achieve this but to no avail. Here’s what I have:
The bitmap is going to the png.
The Animation Script Template is set to 20 frames and an appropriate frame duration.
I’ve tried altering the script a bit:
inc = 0.1
out =0
defineParameter {
name = 'out',
default = 0,
min = 0,
max = 1
}
defineParameter {
name = "frames",
default = 20,
min =1,
max =1000,
type = "integer",
onChanged = function()
inc = 1 / frames
end
}
defineParameter {
name = "frameDuration",
default = 1000 / 24,
min =20,
max = 10000,
type = "integer"
}
function animate()
while true do
out = (out + inc) % 1
wait(frameDuration)
end
end
function onLoadFinished()
runAsync(animate)
end
Any and all help is much appreciated!
Thanks!