ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Set position to composition

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
victor ribbs
Set position to composition
on Jun 19, 2020 at 8:30:57 am

hello,
I dynamically add compositions (as_msg) in a basic composition (as_comp)
var comme_comp = app.project.item (1);
var tels_msg = app.project.item (2);
I tried to assign positions to each tels_msg but without success. I manage to move the layers contained in tels_msg
thank you

// \COMP BASE
var tels_comp = app.project.item(1);
// \COMP MESSAGE
var tels_msg = app.project.item(2);
...
function addMsgs()
{
for ( i = 0; i &lt; tels_data.length; i++){
var _layerCollection = tels_comp.layers;
var msg_instance = tels_msg.duplicate();
//var msg_instance.name = "MSG_INSTANCE_"+i;
var msg_layerCollection = msg_instance.layers;

addAvatar(i, msg_layerCollection.byName("AVATAR_SHAPE"));
addInitialName(i, msg_layerCollection.byName("AVATAR_INITIAL"));
addName(i, msg_layerCollection.byName("SEND_BY"));

_layerCollection.add(msg_instance);
}
}


Return to posts index

victor ribbs
Re: Set position to composition
on Jun 19, 2020 at 5:51:11 pm

hello,

I found the solution to my problem.
the last layer added to layers is always linked in 1

var msg_position = tels_comp.<b>layer(1</b>).property("ADBE Transform Group").property("ADBE Position");

function addMsgs()
{
var nL = 1;
var _layerCollection = tels_comp.layers;

for ( i = 0; i &lt; tels_data.length; i++){

var msg_instance = tels_msg.duplicate();
msg_instance.name = "MSG_INSTANCE_"+i;
var msg_layerCollection = msg_instance.layers;

addAvatar(i, msg_layerCollection.byName("AVATAR_SHAPE"));
addInitialName(i, msg_layerCollection.byName("AVATAR_INITIAL"));
addName(i, msg_layerCollection.byName("SEND_BY"));

_layerCollection.add(msg_instance);
var msg_position = tels_comp.layer(1).property("ADBE Transform Group").property("ADBE Position");
msg_position.setValue([x_pos, y_pos]);

nL++;
y_pos += 120.0;
}
}


Return to posts index

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