Alfred Steiner
Forum Replies Created
-
I found out that it works if I drag and drop the contour layers of the Roto Brush Effect below the brush strokes of a color layer.
The problem is just that this takes so long (about 6 seconds per stroke) that I cannot really manage to do it with the whole animation.
Has anyone some further idea? -
Alfred Steiner
July 22, 2015 at 9:23 am in reply to: interpolated vertices/anchorpoints of shape pathHi okay then I will describe it.
i have a 30 fps Video of rain drops falling into a puddle. now I begin in the first Frame and look where the first rain drop hits the ground. From this point i want a line to be drawn to the second drop which hits the ground and from this one to the third and so on.
so over the frames the lines evolve to a graphic.i hope one can understand this.
regards,
Alf -
Alfred Steiner
July 21, 2015 at 10:36 am in reply to: interpolated vertices/anchorpoints of shape pathAh okay i didnt know this. Is there another possibility than using Hold Keyframes if i want to avoid any interpolation?
-
thanks for your answer but as i wrote in all my topics i am working with too many keyframes and vertices so it is impossible to do it manually.
i wrote a script which works but is very slow
if anyone knows how to improve Script performance let me know
// G L O B A L S
var theComp = app.project.activeItem;
var theLayer = theComp.layer(1);
var thePath = theLayer.property("ADBE Root Vectors Group").property("ADBE Vector Group").property("ADBE Vectors Group").property("ADBE Vector Shape - Group").property("ADBE Vector Shape");
var currentTime = theComp.time; // Current Time in seconds
var activeKeyFrame = thePath.nearestKeyIndex(currentTime); // Number of the active Keyframe starting at 1 ----- > should be the nearest in the past
if (thePath.keyTime(activeKeyFrame) > currentTime) { activeKeyFrame--; }
var currentPath = thePath.keyValue(activeKeyFrame).vertices;
var prevPath = thePath.keyValue(activeKeyFrame-1).vertices;
var nextPath = thePath.keyValue(activeKeyFrame+1).vertices;if (theLayer.marker.numKeys == 0) { // save the last vertex index
if ( Math.abs(currentTime - thePath.keyTime(activeKeyFrame)) > (app.project.activeItem.frameDuration*0.7) ) {
var mv = new MarkerValue((currentPath.length-1)+"-1"); // Array index of last Vertex
} else {
var mv = new MarkerValue((currentPath.length-1)+"-0"); // Array index of last Vertex
}
theLayer.property("Marker").setValueAtTime(currentTime, mv);} else {
var marker = theLayer.marker.keyValue(1).comment.split("-");
//var marker_value = parseInt(theLayer.marker.keyValue(1).comment); // stores last Vertex array index of Current Path before editing
var marker_value = parseInt(marker[0]); // stores last Vertex array index of Current Path before editing
theLayer.marker.removeKey(1); // delete Markerif (marker[1] == "1") { // if new keyframe has been added
alert("new");
var insertPath = currentPath.slice((prevPath.length+1), currentPath.length);
var insert_start = prevPath.length;
var insert_length = 0;
var getVerts;for (var i = (activeKeyFrame+1); i <= thePath.numKeys; i++) { // process all following Keyframes var myShape = new Shape(); // create new Shape to overwrite the original with myShape which is modified by the splice function myShape.closed = false; getVerts =thePath.keyValue(i).vertices; // get vertices Array of the Keyframe with the index i getVerts.splice.apply(getVerts, [insert_start,insert_length].concat(insertPath)); myShape.vertices = getVerts; thePath.setValueAtKey(i,myShape); // setValueAtKey(x, myShape); frame 0 => x = 1 --> es geht bei 1 los
alert(insertPath);
}
} else { // if keyframe existed
var insertPath = currentPath.slice(prevPath.length, currentPath.length);
var insert_start = prevPath.length; // index before first new vertex in currentFrame
var insert_length = (marker_value+1)-insert_start;
var getVerts;for (var i = (activeKeyFrame+1); i <= thePath.numKeys; i++) { // process all following Keyframes // alert("path:"+insertPath+",start:"+insert_start+",length:"+insert_length); var myShape = new Shape(); // create new Shape to overwrite the original with myShape which is modified by the splice function myShape.closed = false; getVerts =thePath.keyValue(i).vertices; // get vertices Array of the Keyframe with the index i getVerts.splice.apply(getVerts, [insert_start,insert_length].concat(insertPath)); myShape.vertices = getVerts; thePath.setValueAtKey(i,myShape); // setValueAtKey(x, myShape); frame 0 => x = 1 --> es geht bei 1 los
alert(insertPath);
}}
}
-
please read what i wrote… i wrote that its about 3000 anchor points which should be exact lines.
-
Well i just got it finally via the following script.
Sadly i didnt found any good reference on the net…
I dont know how to know which properties my objects have and how to refer to them right.
anyways i tried and errored it :
var theComp = app.project.activeItem;
var theLayer = theComp.layer(1);
var thePath = theLayer.property("ADBE Root Vectors Group").property("ADBE Vector Group").property("ADBE Vectors Group").property("ADBE Vector Shape - Group").property("ADBE Vector Shape");
var theKeys = thePath.selectedKeys;var myProperty = 0;
var Verts = 0;
var myShape = 0;var theKeyTime = 0; // holds the time in seconds of a specific Frame later
var Lines = parseInt(prompt("Enter Line Number:"));
var spliceStart = Verts.length - (Lines+1); // + 1 because a line always consists of two points and the first line offers the first point for the second...for (var i = 1; i <= thePath.numKeys; i++) {
theKeyTime = theLayer.content("Form 1").content("Pfad 1").property(2).keyTime(i); // the time in seconds at which the specific keyframe happens
myProperty = theLayer.content("Form 1").content("Pfad 1").property(2).valueAtTime(theKeyTime,true);
Verts = myProperty.vertices;
spliceStart = Verts.length - (Lines+1);if (Verts.length > (Lines+1)) { // if there are already more lines then var Lines defined.
// modify Shape
myShape = 0;
myShape = new Shape();
myShape.closed = false;
myShape.vertices = Verts.splice(spliceStart,(Lines+1));
thePath.setValueAtKey(i,myShape);
}
}
Thanks for your help.
best wishes –
Alf -
thank you for answering.
I just reformulate it quickly as good as I can.
I just clicked on the pen tool then I set the first anchor point in the first frame, then i went to the next frame to set the next anchor point and so on.
I made some screenshots to clear things up, the text in there is irrelevant now.

————————————————————–
now what i meant with “path stroke” is whats seen in the right of this image here :

now if you look at the first picture i put in here, you can see 4 anchor points in the rightmost block.
i didnt set up a stroke for the image. but what i want is that in theonly the last 2 (or any number) lines or path segments are visible.
so in this rightmost block (you see in the bottom of the image that i am in the fourth frame)
i only want to see the line from 4 to 3 and from 3 to 2.-this can be done either by manually deleting all points you dont want to have in every keyframe
(that is not possible in my case)the second option could be drawing a path stroke not from a start in % to an end in % as usually but
somehow from the last point to the two anchor points which where made right befor the last one.
(as i described)the third thing i think is most likely the solution but I need help to realize it.
I need a script which goes through all frames and in each frame through all path anchor points and then
it just deletes the anchor points which i dont want to see .
(therefore you must know that i changed an option in the general settings of after affects which is called somewhat like “keep constant anchorpoint number in mask edit” or so in english).
this allows to change the path completely in the keyframes without changing the number of anchor points in the keyframes before if you know what i mean.the problem is how to do the deleting of those single points via script.
this sounds actually much more complicated like it is.
kind regards,
Al Steiner