Fabrice Leconte
Forum Replies Created
-
Fabrice Leconte
September 10, 2021 at 2:25 pm in reply to: Control more than two keyframes with expressionsHello,
I think you just need to add “if & else” statements.
something like:
if(time < key(3).time){
linear(time,key(1).time,key(2).time,[x – widestA – RLPadding, y],[x – widestEng – RLPadding, y])
}
else{
linear(time,key(3).time,key(4).time,[x – widestEng – RLPadding, y],[x – widestA – RLPadding, y])
}
-
Fabrice Leconte
September 10, 2021 at 9:28 am in reply to: How to connect a shape layer to a wave shape using Math.sin()Hello,
You can adjust the Y position of the ball by testing the collision with the sine wave.
First, I tried to use sampleImage to test the collision, it worked but the rendering time was too long (more than 1 hour for a few seconds of video).
Finally, I tried in a different way, I calculated the distance between the ball and each points of the sine wave and if the distance was lower than the ball radius it means that the sine wave collide with the ball so I adjusted the ball Y position until collision return false.
-
Hello, line 1, convert the string to a number.
xx = Number(thisComp.layer('OFFSET').effect('FLIP MODE')('Menu'));
var jjj = 0
switch(xx){
case 1: jjj =0; break;
case 2: jjj =10; break;
case 3: jjj =30; break;
case 4: jjj =50; break;
case 5: jjj =90; break;
case 6: jjj =130; break;
case 7: jjj =180; break;}
jjj;
-
Fabrice Leconte
September 8, 2021 at 3:42 am in reply to: Copy selected property to a Null Layer's PositionFor Lockdown use this code:
function createNulls() {
var sLayers = thisComp.selectedLayers;
if (!sLayers.length) {
alert('Please, select a layer');
return false;
}
var sProperties = thisComp.selectedLayers[0].selectedProperties;
if (!sProperties.length || sProperties.length < 2) {
alert('Please, select at least 1 property');
return false
}
app.beginUndoGroup('Copy to Null');
for (var i = 0; i < sProperties.length; i++) {
var sProperty = sProperties[i];
if (sProperty.name.match(/Point[1-4]/)) {
var myNull = thisComp.layers.addNull();
myNull.name = sProperty.name;
myNull.transform.position.expression = 'thisComp.layer("' + sLayers[0].name + '").effect("Lockdown")("' + sProperty.name + '")';
// OPTIONAL
// myNull.transform.position.selected = true;
// app.executeCommand(2639); // Convert Expression to Keyframes
// myNull.transform.position.expression = ''; // Remove the Expression
}
}
app.endUndoGroup();
}
var thisComp = app.project.activeItem;
createNulls();
-
Fabrice Leconte
September 7, 2021 at 2:00 pm in reply to: Copy selected property to a Null Layer's PositionIt should work.
function createNulls() {
var sLayers = thisComp.selectedLayers;
if (!sLayers.length) {
alert('Please, select a layer');
return false;
}
var sProperties = thisComp.selectedLayers[0].selectedProperties;
if (!sProperties.length || sProperties.length < 2) {
alert('Please, select at least 1 property');
return false
}
app.beginUndoGroup('Copy to Null');
for (var i = 0; i < sProperties.length; i++) {
var sProperty = sProperties[i];
if (sProperty.numProperties == 2) {
var myNull = thisComp.layers.addNull();
myNull.name = sProperty.name;
myNull.transform.position.expression = 'thisComp.layer("' + sLayers[0].name + '").effect("' + sProperty.name + '")(1)';
myNull.transform.position.selected = true;
// OPTIONAL
// app.executeCommand(2639); // Convert Expression to Keyframes
// myNull.transform.position.expression = ''; // Remove the Expression
}
}
app.endUndoGroup();
}
var thisComp = app.project.activeItem;
createNulls();
-
Fabrice Leconte
September 6, 2021 at 11:43 pm in reply to: Copy selected property to a Null Layer's PositionHello, maybe something like this:
app.beginUndoGroup('Copy to Null');
app.executeCommand(19);
var controller = app.project.activeItem.layers.addNull();
controller.name = 'myProp';
controller.enabled = true;
controller.property('position').selected = true;
app.executeCommand(20);
app.endUndoGroup();
-
Fabrice Leconte
September 4, 2021 at 9:17 pm in reply to: Timer time.toFixed(1) linked to a checkbox control effect.Hello, try this:
myNull = thisComp.layer('Null 1').effect('Checkbox Control')(1);
freeze = 0;
for (i = 1; i <= myNull.numKeys; i++) {
if (i != myNull.numKeys && myNull.key(i) == 0 && time >= myNull.key(i).time) {
freeze += Math.min(myNull.key(Math.min(i + 1, myNull.numKeys)).time, time) - myNull.key(i).time
} else if (i == myNull.numKeys && myNull.key(i) == 0 && time > myNull.key(i).time) {
freeze += time - myNull.key(i).time
}
}
(time - freeze).toFixed(1);
-
OK for multiple rows, try this:
perRow = thisComp.layer('test.csv')('Data')('Outline').numProperties;
numOfRows = thisComp.layer('test.csv')('Data')('Number of Rows');
if (timeToFrames(time) < perRow * numOfRows) {
row = Math.min(Math.floor(timeToFrames(time) / perRow), numOfRows - 1);
col = timeToFrames(time) % perRow;
footage('test.csv').dataValue([col, row]);
} else {
'finished'
}
-
Fabrice Leconte
August 25, 2021 at 10:47 pm in reply to: Where I should put beingUndoGroup and endUndoGroup for undo all in 1 undoHello, place it before and after the FOR loop.
app.beginUndoGroup("undo");
for(var i =0;i<layers.length;i++){
...
}
app.endUndoGroup();
-
Hello, try this:
max = thisComp.layer('test.csv')('Data')('Outline').numProperties -1;
footage('test.csv').dataValue([Math.min(timeToFrames(time),max), 0]);