Class: Tracksperanto::Tool::Scaler
Overview
Scales the comp being exported by a specific factor, together with the tracker keyframes
Constant Summary collapse
- DEFAULT_FACTOR =
1
Class Method Summary collapse
Instance Method Summary collapse
- #export_point(frame, float_x, float_y, float_residual) ⇒ Object
-
#start_export(img_width, img_height) ⇒ Object
Called on export start.
- #x_factor ⇒ Object
- #y_factor ⇒ Object
Methods inherited from Base
Methods included from Parameters
Methods included from SimpleExport
Methods included from ConstName
Methods included from BlockInit
Methods included from Casts
#cast_to_bool, #cast_to_float, #cast_to_int, #cast_to_string
Constructor Details
This class inherits a constructor from Tracksperanto::Tool::Base
Class Method Details
.action_description ⇒ Object
8 9 10 |
# File 'lib/tools/scaler.rb', line 8 def self.action_description "Scale the comp by a specified factor" end |
Instance Method Details
#export_point(frame, float_x, float_y, float_residual) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/tools/scaler.rb', line 27 def export_point(frame, float_x, float_y, float_residual) return super if @y_factor == DEFAULT_FACTOR && @x_factor == DEFAULT_FACTOR super(frame, x_factor < 0 ? (@w + (float_x * x_factor)) : (float_x * x_factor), y_factor < 0 ? (@h + (float_y * y_factor)) : (float_y * y_factor), (float_residual * @residual_factor) ) end |
#start_export(img_width, img_height) ⇒ Object
Called on export start
13 14 15 16 17 |
# File 'lib/tools/scaler.rb', line 13 def start_export( img_width, img_height) set_residual_factor @w, @h = (img_width * x_factor).to_i.abs, (img_height * y_factor).to_i.abs super(@w, @h) end |
#x_factor ⇒ Object
23 24 25 |
# File 'lib/tools/scaler.rb', line 23 def x_factor @x_factor || DEFAULT_FACTOR end |
#y_factor ⇒ Object
19 20 21 |
# File 'lib/tools/scaler.rb', line 19 def y_factor @y_factor || DEFAULT_FACTOR end |