Quantcast
Channel: Adobe Community : Popular Discussions - After Effects Expressions
Viewing all articles
Browse latest Browse all 47983

global array variables? , transfer data from one layer expression to another

$
0
0

hi i have arrays in expression, but i have a problem, every time when i move effect point control(i need move it for my task)  array update and erasing, but i need to save data from previous array state

 

 

i add this expression to text layer on Source text

//create array

var arrayX = [];

var arrayY = [];

//add data to array

arrayX.push(12);

arrayX.push(232);

arrayX.push(2424);

arrayY.push(0);

arrayY.push(322);

arrayY.push(122);

text_cur_layer = text.sourceText;

//final result

text_cur_layer ="Array_X= "+arrayX.join( ', ' )+"\r"+"      Array_Y= "+arrayY.join( ', ' );

 

 

expression return 

in array x must be (12 232 2424)

in arrayY  must be (0 322 122)

 

 

so every time when i change state on effect "point control"(slider control and etc) this expression updates and give me always same numbers, from this commands^

arrayX.push(12);

arrayX.push(232);

arrayX.push(2424);

arrayY.push(0);

arrayY.push(322);

arrayY.push(122);

 

 

it happened because i create array every time with

var arrayX = [];

var arrayY = [];

i think this commands erasing all data from array and create new clean array, so i need some how save previous data...., in AE script i can do that with creation array

globally for all functions, but don't know how  do this in expression

 

 

 

 

also i think it can be done with transfer data from array to string and save this string in another layer and then get this data after array creation, but i don't know how i can save array string data and export this string back?

 

 

example

 

 

var arrayX = [];

var arrayY = [];

//try import previous data back(i don't know how do that, just using standard java code..)

//and now i need get data from strX strY from save place and chekc it later

if(strX!=null && strY!=null)

{

arrayX=strX.split(',');

arrayX=strX.split(',');

}

//add data to array

arrayX.push(12);

arrayX.push(232);

arrayX.push(2424);

arrayY.push(0);

arrayY.push(322);

arrayY.push(122);

text_cur_layer = text.sourceText;

//final result

text_cur_layer ="Array_X= "+arrayX.join( ', ' )+"\r"+"      Array_Y= "+arrayY.join( ', ' );

//get data to save

var strX = arrayX.join(',')

var strY = arrayY.join(', ');

 

 

and then i need some how save this strX and  strY  to save place

 

 

 

 

Sorry for bad English


Viewing all articles
Browse latest Browse all 47983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>