-12 Removals
+98 Additions
//Duik.connector//Duik.connector "absolute animation" mod
var ctrlLayer = thisComp.layer("C | Slider");var ctrlLayer =thisComp.layer("C | Slider 2");
var ctrlValue = ctrlLayer.effect("Slider")(18);var ctrlValue = ctrlLayer.effect("Slider")(18);
var ctrlEffect = ctrlLayer.effect("Value Connector");var ctrlEffect = ctrlLayer.effect("Value Connector");
var ctrlMin = ctrlEffect(2).value;var useVelocity = ctrlEffect(1).value == 2;
var ctrlMax = ctrlEffect(3).value;if (useVelocity) ctrlValue = ctrlValue.velocity;
else ctrlValue = ctrlValue.value;
var tHasKeys = ctrlLayer.transform.xPosition.numKeys > 1;
function connect(keyF){
var ctrlMin = ctrlEffect(2).value; //0
var ctrlMax = ctrlEffect(3).value; //100
var result = value;var result = value;
if (numKeys >= 2 && ctrlEffect.enabled)if (numKeys >= 2 && ctrlEffect.enabled)
{{
var useVelocity = ctrlEffect(1).value == 2;
if (useVelocity) ctrlValue = ctrlValue.velocity;
else ctrlValue = ctrlValue.value;
var t = 0;var t = 0;
var beginTime = key(1).time;var beginTime = key(1).time;
var endTime = key(numKeys).time;var endTime = key(numKeys).time;
if (ctrlMin > ctrlMax)if (ctrlMin > ctrlMax)
{{
t = linear(ctrlValue, ctrlMin, ctrlMax, endTime, beginTime);t = linear(keyF, ctrlMin, ctrlMax, endTime, beginTime);
// t = linear(time, 0, 100, 0.5, 0.0); ????????
}}
elseelse
{{
t = linear(ctrlValue, ctrlMin, ctrlMax, beginTime, endTime);t = linear(keyF, ctrlMin, ctrlMax, beginTime, endTime);
}}
result = valueAtTime(t);result = valueAtTime(t);
}}
Math.floor(result);var driver = Math.floor(result);
//
return driver;
}
sliderController = ctrlLayer.transform.xPosition;
poses = [];
temp = 1;
while ( temp <= thisComp.marker.numKeys ) {
poses.push ( this.value );
i = temp++ ;
}
function getValues(){
var obj_A = sliderController
var ID_A = obj_A.nearestKey(time).index;
var value_A;
var time_A;
var keyF_A;
var keyF_B;
if (obj_A.nearestKey(time).time <= time ){
value_A = obj_A.key(ID_A).value;
time_A = obj_A.key(ID_A).time;
} else {
try{
obj_A.key(ID_A-1).value;
value_A = obj_A.key(ID_A-1).value;
time_A = obj_A.key(ID_A-1).time;
}catch(err){
value_A = obj_A.key(ID_A).value;
time_A = obj_A.key(ID_A).time;
}
}
var obj_B = sliderController
var ID_B = obj_B.nearestKey(time).index;
var value_B;
var time_B;
if (obj_B.nearestKey(time).time >= time ){
value_B = obj_B.key(ID_B).value;
time_B = obj_B.key(ID_B).time;
} else {
//try{
obj_B.key(ID_B+1).value;
value_B = obj_B.key(ID_B+1).value;
time_B = obj_B.key(ID_B+1).time;
}catch(err){
value_B = obj_B.key(ID_B).value;
time_B = obj_B.key(ID_B).time;
}
}
keyF_A = connect(value_A);
keyF_B = connect(value_B);
return linear(time,time_A, time_B, keyF_A, keyF_B);
// time value can't read the easing from the slider keyframes, I must discover a way to mimic the ctrlEffect + UseVelocity shenanigans from the original code.
}
if(tHasKeys) getValues() else key(1).value;
Editor
Original Text
Changed Text
Recommended videos