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
included, #parameter, #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, included
Constructor Details
This class inherits a constructor from Tracksperanto::Tool::Base
Class Method Details
.action_description ⇒ Object
9 10 11 |
# File 'lib/tools/scaler.rb', line 9 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
28 29 30 31 32 33 34 35 36 |
# File 'lib/tools/scaler.rb', line 28 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
14 15 16 17 18 |
# File 'lib/tools/scaler.rb', line 14 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
24 25 26 |
# File 'lib/tools/scaler.rb', line 24 def x_factor @x_factor || DEFAULT_FACTOR end |
#y_factor ⇒ Object
20 21 22 |
# File 'lib/tools/scaler.rb', line 20 def y_factor @y_factor || DEFAULT_FACTOR end |