survey_animation = function() ---[[ '--' at start to disable animation, '---' to enable local minx, miny, maxx, maxy = surface_bounds(Definitions) -- ensure 1px of white background all around -- just in case the viewport ever goes -- outside canvas bounds while animating minx,miny, maxx,maxy = minx-1,miny-1, maxx+2,maxy+1 local zoomx = App.screen.width/(maxx-minx) local zoomy = App.screen.height/(maxy-miny) local zoom, cw, ch if zoomx < zoomy then zoom = zoomx cw = maxx-minx ch = cw*App.screen.height/App.screen.width else zoom = zoomy ch = maxy-miny cw = ch*App.screen.width/App.screen.height end Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom} snapshot_canvas() -- initialize animation Animating = { copy_viewport(Global_viewport), copy_viewport(Viewport), } Viewport.x = -App.screen.width/2 Viewport.y = -App.screen.height/2 Viewport.w = App.screen.width Viewport.h = App.screen.height Viewport.zoom = 1.0 --]] end