FORUMS: list search recent posts

Position Null with a Slider value

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mattia Furlan
Position Null with a Slider value
on Apr 30, 2015 at 3:27:22 pm

Hello everyone. I'm attempting to make a short film like a video game that look like a fighting genre. I've made a character selection screen and I want to animate the position of the selection cursor based on a slider controller with keyframes (1.00, 2.00, 3.00 etc...)
I'm not an expert of expression. I found the expression below in another thread and I have adapted to my needs. But after effects came out with this error:
"Error at line 0 in property 'Position' of layer 4 ('P1_Selection.psd') in comp 'Characters List'. Array piece can't expand more than one value.
From what I understand, he doesn't know how many variables there are in the array but I don't know how to fix it (maybe there's something else).
Can someone help me please? Thank you.

//Characters List

//BaxPep
C1 = thisComp.layer("Bax_pep.psd").transform.position;
//Koala
C2 =thisComp.layer("Koala.psd").transform.position;
//Locked 1
C3 = thisComp.layer("LOCKED.psd 2").transform.position;
//John Law
C4 = thisComp.layer("John_Law.psd").transform.position;
//Daniel Akam
C5 =thisComp.layer("Daniel_Akam.psd").transform.position;
//Locked 2
C6 = thisComp.layer("LOCKED.psd 3").transform.position;
//Locked 3
C7 = thisComp.layer("LOCKED.psd 4").transform.position;
//Matthew
C8 =thisComp.layer("Matthew.psd").transform.position;
//David_Fury
C9 = thisComp.layer("David_Fury.psd").transform.position;
//Locked 4
C10 = thisComp.layer("LOCKED.psd 5").transform.position;
//Locked 5
C11 = thisComp.layer("LOCKED.psd 6").transform.position;
//Prof. Frank
C12 = thisComp.layer("Prof_Frank.psd").transform.position;
//Locked 6
C13 = thisComp.layer("LOCKED.psd 7").transform.position;
//Locked 7
C14 = thisComp.layer("LOCKED.psd 8").transform.position;
//Locked 8
C15 = thisComp.layer("LOCKED.psd 9").transform.position;
//Locked 9
C16 = thisComp.layer("LOCKED.psd 10").transform.position;
//Locked 10
C17 = thisComp.layer("LOCKED.psd 11").transform.position;
//Locked 11
C18 = thisComp.layer("LOCKED.psd").transform.position;
//Random
R = thisComp.layer("Random.psd").transform.position;

PlayerChart = ["C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "C10", "C11", "C12", "C13", "C14", "C15", "C16", "C17", "C18", "R"];
Sel = thisComp.layer("SELECTION_CONTROLLER").effect("Slider Control")("Slider").value;

try{
thisComp.layer([Math.round(Sel)-1]).transform.position;
}catch(err){
[R];
}


Return to posts index

Dan Ebberts
Re: Position Null with a Slider value
on Apr 30, 2015 at 5:51:37 pm

I haven't tried your expression, but I think you need to get rid of the square brackets in the last part:


try{
thisComp.layer(Math.round(Sel)-1).transform.position;
}catch(err){
R;
}



Dan



Return to posts index

Mattia Furlan
Re: Position Null with a Slider value
on May 1, 2015 at 1:21:37 am

Thank you for the reply Dan,
expression accepted now BUT unfortunately the position of the layer doesn't really go where I want... :(
I would like that when I set value 1.00 on the slider it goes in "C1" position, with 2.00 in "C2", 3.00 in "C3" etc...
How can I do that?


Return to posts index



Dan Ebberts
Re: Position Null with a Slider value
on May 1, 2015 at 1:42:05 am

Again, I haven't tested this at all, so there are bound to be errors, but I would think you could set it up like this:


C = ["Bax_pep.psd",
"Koala.psd",
"LOCKED.psd 2",
"John_Law.psd",
"Daniel_Akam.psd",
"LOCKED.psd 3",
"LOCKED.psd 4",
"Matthew.psd",
"David_Fury.psd",
"LOCKED.psd 5",
"LOCKED.psd 6",
"Prof_Frank.psd",
"LOCKED.psd 7",
"LOCKED.psd 8",
"LOCKED.psd 9",
"LOCKED.psd 10",
"LOCKED.psd 11",
"LOCKED.psd"];

Sel = thisComp.layer("SELECTION_CONTROLLER").effect("Slider Control")("Slider").value;

try{
thisComp.layer(C[Math.round(Sel)-1]).transform.position;
}catch(err){
thisComp.layer("Random.psd").transform.position;
}




Return to posts index

Mattia Furlan
Re: Position Null with a Slider value
on May 1, 2015 at 9:00:34 pm
Last Edited By Mattia Furlan on May 1, 2015 at 10:16:03 pm

Thank you again Dan! :D It's working!!
Just I don't understand...I declared every variable for the position, while your expression lists just the layer name...I never thought this could work.
Whatever thank you again.


Return to posts index

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