Page 1 of 1

From file to mask ... syntax problem

Posted: July 15th, 2008, 10:12 am
by valoos
Hello everybody...

I have some graph/chart to do. I want to do mask/shape (AE7) from data file.
I found some help at http://www.motionscript.com but i'm stuck.
My problem lies in syntax. I don't know how to "push" my variable TempVar in to myShape.verticles

Code: Select all

var newMask = mySolid.Masks.addProperty("Mask");
  		newMask.inverted = false;
  		var myMaskShape = newMask.property("maskShape");
  		var myShape = myMaskShape.value;
while (!myFile.eof)
      {
        i ++;
        text = myFile.readln();
        if (text == "") text = "\r" ;
	 {number = parseFloat(text);
  	 TempVar[i]=[i,number];} <--- this line is my problem ;)
  	 }
  myShape.verticles = TempVar;    	   
  myMaskShape.setValue(myShape);
Does anyone know how to do that?
May be there is much elegant way to solve my task.

BTW. This is my first post at the ae enhancers forum and any english forum at all, therefore...
I'm sorry for my english :P

Re: From file to mask ... syntax problem

Posted: July 18th, 2008, 10:24 am
by Atomic
Here is my post on creating animated mask.

I also started off by visiting motion script.

http://www.aenhancers.com/viewtopic.php ... hilit=mask

I hope this helps. :wink:

Re: From file to mask ... syntax problem

Posted: July 19th, 2008, 8:59 am
by valoos
Thanks for answer...

I'm reading and reading and reading and I'm still not understanding. (I can't find a solution) :oops:
I want to create shape (mask) from pairs of numbers. Sometime will be 5 pairs and sometimes 105. I don't know how to "push" another vertice after previous. When I used "myShape.verticles = myPairOfNumbers" or "myShape = myPairOfNumbers", AE made a open square (I set myShape.closed = false)
Can I use variable myShape like an array ?

Where can I find a list of AE Script's method ? (The file ae7_scripting_guide.pdf from adobe site is very poor of it)

Re: From file to mask ... syntax problem

Posted: July 21st, 2008, 5:34 am
by Atomic
From what I can tell in your loop, you are assigning the loop index as one of the data values for a point.
Consider this line...

Code: Select all

TempVar[i]=[i,number];
Notice, you are using the loop index i as one of your data values.

Now consider the line from my exmaple post.

Code: Select all

  myShape.vertices = [[5,5],[5,45],[45,45],[45,5]];
Which could also be written like this...(ie your form).

Code: Select all

myShape.verticies[i] = [5,5]
So this is the trouble line in your example.

Code: Select all

number = parseFloat(text);
I'm not sure what the parseFloat function does, but you need some way to get TWO numbers not just a single number.

More pseudo code...

Code: Select all

numberX = parseFloat(text);
numberY = parseFloat(text);
TempVar[i]=[numberX, numberY]; 
Because I do not know what format your data is in, I can not go any further, but perhaps you get the idea...

Re: From file to mask ... syntax problem

Posted: September 10th, 2008, 1:54 am
by valoos
1. parseFloat(text) returns float type of number from text
2. in my "trouble line": TempVar=[i,number]; are two numbers, but I think AE don't get it like a pair because one is integer type, second is float type.

Finally, I used write-on effect to solve my task (write chart from txt file), but now I'm back to play with masks in another problem. Soon I'll report my progression of it.