-
Notifications
You must be signed in to change notification settings - Fork 56
/
setLoop.jsx
34 lines (27 loc) · 1.08 KB
/
setLoop.jsx
1
//Snippet for adding a time remap loop for each selected layer//CC-BY, Nik Ska, 2013var setLoop = this;setLoop.loopExpression = "try{\n\n\tshift=effect('ADBE Effect Parade')('ADBE Slider Control')*thisComp.frameDuration;\n\t(time+shift)%thisLayer.source.duration;\n}\ncatch(err){value}";setLoop.go = function(){ var activeComp = app.project.activeItem; if(activeComp && activeComp instanceof CompItem){ var sel = activeComp.selectedLayers; if(sel){ for(var s = 0; s < sel.length; s++){ if(sel[s].canSetTimeRemapEnabled){ sel[s].timeRemapEnabled = true; setLoop.setSlider(sel[s], 'Loop Shift', 0, ''); sel[s].property("ADBE Time Remapping").expression = setLoop.loopExpression; } } } }}setLoop.setSlider = function(masterLayer, slName, slValue, slExpression){ //adding a slider to the master layer var sl = masterLayer.property("ADBE Effect Parade").addProperty("ADBE Slider Control"); sl.name = slName; sl.property("ADBE Slider Control-0001").setValue(slValue); sl.property("ADBE Slider Control-0001").expression = slExpression;}setLoop.go()