ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Xeyes

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Martim Lopes
Xeyes
on Oct 18, 2015 at 2:51:33 pm

Hi,

I'm trying to create a comp where I have two eyes that follow a null object's position.

Here's an example: http://www.javascriptkit.com/script/script2/xeye.shtml

Thanks in advance


Return to posts index

Kalle Kannisto
Re: Xeyes
on Oct 18, 2015 at 6:31:18 pm
Last Edited By Kalle Kannisto on Oct 18, 2015 at 6:49:06 pm

Use this for the iris position:

origin_x=576;// rest position X value, center point of eye
origin_y=390;// rest position Y value
eye_height = 120; // vertical radius or eyeball
eye_width =80; // horizontal radius of eyeball
offset_mult = .25; // decrease in eye movement
eye_proportion =eye_height/eye_width;
x0=thisComp.layer("Null 1").transform.position[0]-origin_x;//your null reference here
y0=thisComp.layer("Null 1").transform.position[1]-origin_y;//your null reference here
distance0 = Math.sqrt(x0*x0+y0*y0)*offset_mult;
distance = Math.min(distance0,eye_width);
if (distance0>eye_width){
distance_mult = distance/distance0;
}else{
distance_mult = 1
}

x=origin_x+distance_mult*x0*offset_mult;
y=origin_y+distance_mult*y0*offset_mult*eye_proportion;

[x,y]


Return to posts index

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