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)
if state.initial == nil then
state.initial = from_viewport(state)
-- once we've checked keys, pollute the keyspace
state.step = 0
state.frame_time = 0
return
end
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
state.frame_time = state.frame_time - 0.01
state.step = state.step+1
interpolate_viewport(state.initial, state, state.step)
B()
end
end
print('animation frame: Viewport is now', Viewport.x, Viewport.y, Viewport.zoom)
animate_next = function(dt)
if Animating[1].step and Animating[1].step >= Num_animation_frames then
table.remove(Animating, 1)
if #Animating == 0 then
Animating = nil
Canvas = nil
A()
return
end
end
animate_next_frame(Animating[1], dt)
end
Global_viewport = nil
print('Viewport at end of survey animation', Viewport.x, Viewport.y, Viewport.zoom)
Animating = nil -- set this to enable animation
-- When enabled, animation should consist of a series of viewport states that we animate into.
-- Each viewport state will be attained in Num_animation_frames frames, each of 0.01 ms or 1 Love frame.
-- Each state will specify the final state of various viewport keys. Keys not mentioned will remain unchanged.
animate_to = function(dest)
local state = {
x=dest.x, y=dest.y, zoom=dest.zoom,
initial=from_viewport(dest),
step = 0,
frame_time = 0,
}
while true do
love.event.pump()
for name, a,b,c,d,e,f in love.event.poll() do
if name == "quit" then
os.exit(0)
end
-- ignore other events
end
-- update
dt = love.timer.step()
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
state.frame_time = state.frame_time - 0.01
state.step = state.step + 1
if state.step >= Num_animation_frames then
return
end
interpolate_viewport(state.initial, state, state.step)
print('animation frame: Viewport is now', Viewport.x, Viewport.y, Viewport.zoom)
B()
end
-- draw
love.graphics.origin()
love.graphics.clear(love.graphics.getBackgroundColor())
local q = love.graphics.newQuad(
(Viewport.x-Global_viewport.x)*Viewport.zoom,
(Viewport.y-Global_viewport.y)*Viewport.zoom,
App.screen.width,
App.screen.height,
Global_bounds.w*Viewport.zoom,
Global_bounds.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
love.graphics.present()
love.timer.sleep(0.001)
end
end
Animating = {
Save_viewport,
}
Save_viewport = nil
animate_to(Save_viewport)
print('Viewport at end of undo zoom out animation', Viewport.x, Viewport.y, Viewport.zoom)
Canvas = nil
Global_viewport = nil
A()
Animating = {
{
x=sx(x)-App.screen.width/Save_viewport.zoom/2,
y=sy(y)-App.screen.height/Save_viewport.zoom/2,
w=App.screen.width/Save_viewport.zoom,
h=App.screen.height/Save_viewport.zoom,
zoom=Save_viewport.zoom,
},
animate_to{
x=sx(x)-App.screen.width/Save_viewport.zoom/2,
y=sy(y)-App.screen.height/Save_viewport.zoom/2,
zoom=Save_viewport.zoom,
if Animating then
local q = love.graphics.newQuad(
(Viewport.x-Global_viewport.x)*Viewport.zoom,
(Viewport.y-Global_viewport.y)*Viewport.zoom,
App.screen.width,
App.screen.height,
Global_bounds.w*Viewport.zoom,
Global_bounds.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
return
end