Forum Replies Created

  • Alex English

    June 15, 2008 at 9:09 am in reply to: restricted area for random layers

    The following worked for me. Just set the windowpercent variable to whatever percentage of the area of the comp you want to block out in the center. So, say you need a window in the center that is 20% of the comp width wide and 20% of the comp width tall, you would set windowpercent = 20/100

    x = 10;
    f = thisComp.frameDuration * x;
    posterizeTime(1 / f);
    minPos = [0,0];
    maxPos = [thisComp.width, thisComp.height];
    loc = random(minPos, maxPos);
    windowpercent = 50 / 100;
    widthleft = thisComp.width * (1 – windowpercent);
    heightleft = thisComp.height * (1 – windowpercent);
    finalpos = []
    if(loc[0] < (thisComp.width - widthleft / 2) && loc[0] > (widthleft / 2))
    {
    side = (thisComp.width / 2) – loc[0];
    if(side < 0) finalpos[0] = thisComp.width - widthleft / 2 - side * (1 - windowpercent); else finalpos[0] = widthleft / 2 - side * (1 - windowpercent); } else finalpos[0] = loc[0]; if(loc[1] < (thisComp.height - heightleft / 2) && loc[1] > (heightleft / 2))
    {
    side = (thisComp.height / 2) – loc[1];
    if(side < 0) finalpos[1] = thisComp.height - heightleft / 2 - side * (1 - windowpercent); else finalpos[1] = heightleft / 2 - side * (1 - windowpercent); } else finalpos[1] = loc[1]; finalpos;

    It seems like there should be a much simpler answer than this, but it’s what I came up with. It worked for me to do what I think you were asking for. Hopefully it can serve as a functional base for you to develop what you need.

  • Alex English

    May 29, 2008 at 8:33 pm in reply to: Simple Expression Request

    I found that you can also access the position of the parent layer directly.

    Using parent.transform.position will get you the position of the parent layer.

    Using this as your position would let you change the sign in the text layer as was suggested, and change the opacity, both while still doing it with a parent relationship, which seems like the cleanest way to handle it.

  • Alex English

    May 27, 2008 at 5:24 pm in reply to: Simple Expression Request

    To preface, please forgive me if any of these don’t work. I don’t have AE available at the moment.

    To handle the charges, you can create the plus and minus symbols and parent them to the balls, then move them to the same spot over the ball.

    To make them fade, you use an expression for opacity that uses their position to determine how transparent they are. They would look something like this:
    for positive:

    swingwidth = thisComp.width;
    halfwidth = swingwidth / 2;
    Math.max(((halfwidth – transform.position) / halfwidth), 0) * 100

    for negitive:

    swingwidth = thisComp.width;
    halfwidth = swingwidth / 2;
    Math.max((swingwidth – halfwidth – transform.position) / halfwidth), 0) * 100

    Those would give you a smooth linear fade in opacity for each of those that should match what you were looking for.

    If you were needing to make the balls move, you could either animate them with keyframes, animate with keyframes and loop as necessary with expressions, or if you were going for something more sinusoidal, you could use:

    freq = 2; //multiplier to change the speed, set where you need it.
    swingwidth = 300; //determines how far out they should move
    [(swingwidth * Math.sin(time * freq) + thisComp.width / 2), 240]

    That should make it oscillate 600 px from end to end, balanced at the center of the comp.

    Once again, I can’t test any of those right now, but if those don’t work out I can check them out later today.

    Good luck.

  • Alex English

    April 23, 2008 at 10:39 pm in reply to: variable minimum value

    I know you have this solved already, but I thought I’d post this for others who happen by.

    Since the data you’re working with is from 0 to 100, if you use Math.max(value, 15), you’re losing 15% of your range.

    Another way to handle it would be to multiply your value by 0.85, then add 15:
    scalefactor = (value * 0.85) + 15;

    This would scale your range of data to your range of motion, and guarantee that your minimum would be at 15 (since at a value of zero, it comes out to 0 + 15)

    I hope someone finds that useful.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy