Activity › Forums › Adobe After Effects › add vertex point in future keyframes
-
add vertex point in future keyframes
Posted by Alfred Steiner on July 16, 2015 at 1:47 pmHello people,
I am animating a path in the way that i am just adding vertex points in differnt keyframes.
I described it in my last post here in the forum : https://forums.creativecow.net/thread/2/1063849#1063849now my question is , how can i add an vertex point in earlier keyframes so that all keyframes in the future also have the part of the path modified by this change ?
in other words :
how can i add an anchor point in multiple keyframes at once ?
if it is still not easy to understand:
This guy here asked something similar https://forums.creativecow.net/thread/2/933222kind regards,
AlfAlfred Steiner replied 11 years ago 53,348 Members · 1 Reply -
1 Reply
-
Alfred Steiner
July 18, 2015 at 3:18 pmthanks 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);
}}
}
Reply to this Discussion! Login or Sign Up