View Single Post
Old 09-07-2018, 12:10 PM   #5
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

This one zooms to the center of current view:

Code:
local zoom_level = 0.25 -- (quarter of project length)

function zoom()
  local arr_start, arr_end = reaper.GetSet_ArrangeView2(0, false, 0, 0)
  local center_of_view = arr_start + 0.5*(arr_end - arr_start)
  local new_arr_length = reaper.GetProjectLength(0) * zoom_level
  reaper.GetSet_ArrangeView2(0, true, 0, 0, center_of_view - (0.5*new_arr_length), center_of_view + (0.5*new_arr_length))
end

reaper.defer(zoom)
spk77 is offline   Reply With Quote