@@ -135,6 +135,20 @@ function lerp(v0, v1, t)
135
135
return v0 * (1 - t ) + v1 * t ;
136
136
end
137
137
138
+ ---
139
+ -- Ease a time value in and out
140
+ --- @param t number Time between 0 and 1
141
+ --- @return number
142
+ function ease_in_out (t )
143
+ t = t * 2
144
+ if t < 1 then
145
+ return 0.5 * t * t * t
146
+ else
147
+ t = t - 2
148
+ return 0.5 * (t * t * t + 2 )
149
+ end
150
+ end
151
+
138
152
---
139
153
-- Clamps a given value between min and max
140
154
--- @param min number The min value
@@ -172,8 +186,9 @@ function get_monitor_info(source)
172
186
-- TODO: Update this with some custom FFI calls to find the monitor top-left x and y coordinates if it doesn't work for anyone else
173
187
-- TODO: Refactor this into something that would work with Windows/Linux/Mac assuming we can't do it like this
174
188
if found then
175
- local x , y = found :match (" @ (%d+),(%d+)" )
176
- local width , height = found :match (" : (%d+)x(%d+)" )
189
+ log (" Parsing display name: " .. found )
190
+ local x , y = found :match (" (%d+),(%d+)" )
191
+ local width , height = found :match (" (%d+)x(%d+)" )
177
192
178
193
info = { x = 0 , y = 0 , width = 0 , height = 0 }
179
194
info .x = tonumber (x , 10 )
@@ -186,6 +201,9 @@ function get_monitor_info(source)
186
201
if info .width == 0 and info .height == 0 then
187
202
info = nil
188
203
end
204
+ else
205
+ log (" Warning: Could not find display name.\n " ..
206
+ " Try using the 'Set manual monitor position' option and adding override values" )
189
207
end
190
208
end
191
209
@@ -617,10 +635,10 @@ function on_timer()
617
635
if zoom_state == ZoomState .ZoomingIn and use_auto_follow_mouse then
618
636
zoom_target = get_target_position (zoom_info )
619
637
end
620
- crop_filter_info .x = lerp (crop_filter_info .x , zoom_target .crop .x , zoom_time )
621
- crop_filter_info .y = lerp (crop_filter_info .y , zoom_target .crop .y , zoom_time )
622
- crop_filter_info .w = lerp (crop_filter_info .w , zoom_target .crop .w , zoom_time )
623
- crop_filter_info .h = lerp (crop_filter_info .h , zoom_target .crop .h , zoom_time )
638
+ crop_filter_info .x = lerp (crop_filter_info .x , zoom_target .crop .x , ease_in_out ( zoom_time ) )
639
+ crop_filter_info .y = lerp (crop_filter_info .y , zoom_target .crop .y , ease_in_out ( zoom_time ) )
640
+ crop_filter_info .w = lerp (crop_filter_info .w , zoom_target .crop .w , ease_in_out ( zoom_time ) )
641
+ crop_filter_info .h = lerp (crop_filter_info .h , zoom_target .crop .h , ease_in_out ( zoom_time ) )
624
642
set_crop_settings (crop_filter_info )
625
643
end
626
644
else
@@ -953,11 +971,11 @@ end
953
971
function script_defaults (settings )
954
972
-- Default values for the script
955
973
obs .obs_data_set_default_double (settings , " zoom_value" , 2 )
956
- obs .obs_data_set_default_double (settings , " zoom_speed" , 0.1 )
957
- obs .obs_data_set_default_bool (settings , " follow" , false )
974
+ obs .obs_data_set_default_double (settings , " zoom_speed" , 0.06 )
975
+ obs .obs_data_set_default_bool (settings , " follow" , true )
958
976
obs .obs_data_set_default_bool (settings , " follow_outside_bounds" , false )
959
- obs .obs_data_set_default_double (settings , " follow_speed" , 0.1 )
960
- obs .obs_data_set_default_int (settings , " follow_border" , 2 )
977
+ obs .obs_data_set_default_double (settings , " follow_speed" , 0.25 )
978
+ obs .obs_data_set_default_int (settings , " follow_border" , 8 )
961
979
obs .obs_data_set_default_int (settings , " follow_safezone_sensitivity" , 4 )
962
980
obs .obs_data_set_default_bool (settings , " follow_auto_lock" , false )
963
981
obs .obs_data_set_default_bool (settings , " use_monitor_override" , false )
0 commit comments