ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

add vertex point in future keyframes

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alfred Steiner
add vertex point in future keyframes
on Jul 16, 2015 at 1:47:16 pm
Last Edited By Alfred Steiner on Jul 16, 2015 at 2:11:51 pm

Hello 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#1063849

now 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/933222

kind regards,
Alf


Return to posts index

Dave LaRonde
Re: add path points in future keyframes
on Jul 16, 2015 at 2:11:50 pm

Select the keyframes you want by click-dragging around them. Position the timeline cursor (AKA the CTI) to the point in time where you want the first selected keyframe to appear. Then paste.

If you want to paste the copied keyframes BEFORE the existing keyframes, move all the existing keyframes further down the timeline and THEN use the select-copy-paste procedure described above.

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA


Return to posts index

Alfred Steiner
Re: add vertex point in future keyframes
on Jul 18, 2015 at 3:18:28 pm
Last Edited By Alfred Steiner on Jul 19, 2015 at 4:12:10 pm

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 Marker

if (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);
}

}
}


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]