Steve Sierra
Forum Replies Created
-
Did you do it like this ?
killDeadSpace(slateComp, false);
var totalDuration = 0;
for(i = 0; i < slateComp.numLayers; i++) {
var currLayer = slateComp.layers[i + 1];
var currItem = currLayer.source;
if(currItem.hasAudio == true && currItem.hasVideo == false){
}else{
totalDuration += currLayer.source.duration;
}
slateComp.duration = totalDuration;Still can’t test 😉
-
Hi,
I’m not sure this is the most efficiant way, but you could maybe use this. You have to be at the Item level :
var currItem = currLayer.source;
if(currItem.hasAudio == true && currItem.hasVideo == false){
}else{//———————-Your code here—————
};
I can’t test this, I have a project rendering… and I think “.hasAudio” doesn’t exist for CS6, and that’s what I’m using.
Hope it helps anyway,Cheers !
-
Hi,
I think I found what I was doing wrong thanks to this page:
https://omino.com/pixelblog/2008/12/25/ae-mask-vertices-from-extendscript/
before the last line, I had to re-inject the vertices in the shape, and then set the value of the shape, not with “=”.
So the ending should have been :modifiedShape.vertices = origVertsM;
copyShape.setValue(modifiedShape);Cheers !
-
Hi,
The link was working…
Here’s a little project I put together quickly with the method I suggested. It still needs tweaking, but it could be a start :
https://f1.creativecow.net/11312/smoke?uploaded=file
Good luck !
😉 -
Hi,
I think you just forgot the curly parenthesis for your else statements :
moveFrames = 20;
try{
m = thisLayer.marker.key(“UP”);
}catch(err){
m = null;
}
if (m != null && time > m.time){
t = time – m.time;
dur = framesToTime(moveFrames);
y = ease(t,0,dur,value[1],value[1]-height);
[value[0],y]
}
else{ //———-HERE———————–
try{
m = thisLayer.marker.key(“DOWN”);
}catch(err){
m = null;
}
if (m != null && time > m.time){
t = time – m.time;
dur = framesToTime(moveFrames);
y = ease(t,0,dur,value[1],value[1]+height);
[value[0],y]
}
else
value
}//———–AND HERE——————-Cheers !
😉 -
Hi Dan,
Thanks for your quick reply !
That’s exactly what I am trying to do… The problem is, isn’t v[0] the first vertex of the shape, v[1] the second, etc…
I don’t know how to get to “v[0].value[0]” or “v[0].value[1]”.Here’s what I’m doing :
var origLayer = app.project.activeItem.selectedLayer[0];
var origHalfX = origLayer.width/2;
var origHalfY = origLayer.height/2;
var origShape = origLayer.property(“ADBE Mask Parade”).property(“ADBE Mask Atom”).property(“ADBE Mask Shape”).value;
var origVerts = origShape.vertices;for(var i = 0; i< numZLayers; i++){
var copyLayer = origLayer.duplicate();
var copyShape = copyLayer.property(“ADBE Mask Parade”).property(“ADBE Mask Atom”).property(“ADBE Mask Shape”).valuevar modifiedShape = origShape;
var modifiedVerts = modifiedShape.vertices;
var h = origHalfX * (i/numZLayers);
var v = origHalfY * (i/numZLayers);for(var j = 0; j < origVerts.length; j++){
var Overt = origVerts[j];
var Mvert = modifiedVerts[j];
var OvertX = Overt[0];
var OvertY = Overt[1];if(OvertX < origHalfX && OvertY < origHalfY){origVertsM[j] = [OvertX + h, OvertY + v]};
if(OvertX < origHalfX && OvertY > origHalfY){origVertsM[j] = [OvertX + h, OvertY – v]};
if(OvertX > origHalfX && OvertY < origHalfY){origVertsM[j] = [OvertX – h, OvertY + v]};
if(OvertX > origHalfX && OvertY > origHalfY){origVertsM[j] = [OvertX – h, OvertY – v]};
}
copyShape = modifiedShape;Thanks !;)
-
Steve Sierra
April 30, 2017 at 4:39 pm in reply to: How to add two expressions to a single property?Hi,
I think if you replace the end of your expression with this, it works :
if (n > 0){
v = velocityAtTime(key(n).time – thisComp.frameDuration/10);
amp = .05;
freq = 4.0;
decay = 2.0;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t) + wiggle(0.25,50);
}else{
value+ wiggle(0.25,50);
}I just added the wiggle to each value instead of putting it at the end.
Hope this helps.
Cheers !
😉 -
Hi,
In the first lines, you declare and give a value to your variables (that’s why you use “var” before, although it isn’t obligatory in expressions).
Then, in the last line(s), you use these variables to assign a value to your property (position in your cases). The brackets are there to express a multi-value property (x,y or x,y,z for position / x,y,z rotation, etc…)
Other properties (like 2d rotation) only take one value, so you don’t use the brackets.Hope this clarifies things a bit for you ????
Cheers ! -
Hi David,
Sorry, I don’t really understand what you’re looking for… Do you maybe have an example you can share ?
Cheers !
-
Steve Sierra
April 29, 2017 at 5:38 am in reply to: offset on local y-axis of auto positioned and rotated object between two pointsHi Lars,
I can’t seem to get what you need…. not a vector pro either ????
I’ll continue playing with the expression when I have a bit of time.Meanwhile, maybe one of the real expressioneers can help you out !
Good luck !