Class: Tracksperanto::Export::AE
- Inherits:
-
Base
- Object
- Base
- Tracksperanto::Export::AE
show all
- Defined in:
- lib/export/cosa.rb
Overview
Exports trackers as an AfterEffects script creating nulls
Constant Summary
collapse
- PREAMBLE =
'// Run this script from the Script Editor
function convertFrameToSeconds(layerWithFootage, frameValue)
{
var comp = layerWithFootage.containingComp;
var rate = 1.0 / comp.frameDuration;
// Frames in AE are 0-based by default
return (frameValue) / rate;
}'
Instance Attribute Summary
Attributes inherited from Base
#io
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#end_export, inherited, #initialize
Methods included from ConstName
#const_name, included
#just_export
Class Method Details
.desc_and_extension ⇒ Object
14
15
16
|
# File 'lib/export/cosa.rb', line 14
def self.desc_and_extension
"createNulls.jsx"
end
|
.human_name ⇒ Object
18
19
20
|
# File 'lib/export/cosa.rb', line 18
def self.human_name
"AfterEffects .jsx script generating null layers"
end
|
Instance Method Details
#end_tracker_segment ⇒ Object
41
42
43
|
# File 'lib/export/cosa.rb', line 41
def end_tracker_segment
@count += 1
end
|
#export_point(frame, abs_float_x, abs_float_y, float_residual) ⇒ Object
37
38
39
|
# File 'lib/export/cosa.rb', line 37
def export_point(frame, abs_float_x, abs_float_y, float_residual)
@io.puts('pos.setValueAtTime(convertFrameToSeconds(layer%d, %d), [%0.5f,%0.5f]);' % [@count, frame, abs_float_x, @height - abs_float_y])
end
|
#start_export(w, h) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/export/cosa.rb', line 22
def start_export(w, h)
@io.puts(PREAMBLE)
@io.puts("")
@count = 0
@height = h
end
|
#start_tracker_segment(tracker_name) ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/export/cosa.rb', line 29
def start_tracker_segment(tracker_name)
@io.puts("")
@io.puts('var layer%d = app.project.activeItem.layers.addNull();' % @count)
@io.puts( 'layer%d.name = %s;' % [@count, tracker_name.inspect])
@io.puts("")
@io.puts('var pos = layer%d.property("Transform").property("Position");' % @count)
end
|