-
Complex ways to specify width and height for expressions.
Hello!
I am fairly new to writing expressions in Adobe After Effects and need some help. I am trying to write an expression that will generate 300 positions for 300 location-pin images inside a composition without having to manually move each pin to a new location inside the composition.
To do that, I created an expression for the first location pin’s position as follows:
seedRandom(3,true);
random([thisComp.width,thisComp.height])Then copied and pasted it 300 times.
The problem with this is that it sets the random position to the entire composition’s width and height, whereas I want it to set to x and y values that are inside the confines of a not-perfectly-shaped map in the composition. I have tried to mask my object and then write something like this:
seedRandom(9,true);
temp = thisComp.layer(“USAMAP”).mask(“Mask 1”).maskPath.width;
temps = thisComp.layer(“USAMAP”).mask(“Mask 1”).maskPath.height;
random([temp.temps])But as I mentioned, I’m still really new to this, so any help is greatly appreciated.
Side question (not as important as my first): When dealing with tons of small images on a very large scale like 300+, is there an easier way to replicate the image without physically copying and pasting? Is there some sort of code that tells After Effects to copy an image and run it `x’ amount of times in the background? As of now, I’ve been using sequence layers and stretching the right tail-end of my timeline for all 300 images. I’m just curious.
Thanks for all the help!