-
Leaf falling expression (how do i get it to delay?)
Hi
i adapted one of Dan Ebberts tutorials to make a leaf fall from a tree. i’m really happy with it but i need it to start later than right at the beginning… and i’m having trouble doing that.
I’ve posted the expressions below.
i’m quite new to AE expressions… any help will probably save me hours of trying to struggle with it myself.
Thanks
Simon
so this is what i have…
there is a null layer and on the image of the leaf there are these expressions…
The Point Effect (renamed ‘Life’)
lmin = 1.5; //minimum particle life
lmax = 3; //maximum particle lifeseed_random(1,true);
life=random(lmin,lmax);
birth=0;
[birth,life]Postition
gmin=20; //gravity
gmax=70;
w=20; //wind
wdir=0; //wind direction (0 = from left)
vmin=100; //minimum initial velocity
vmax=300; //maximum initial velocity
amin=30; //minimum launch angle from vertical
amax=120; //maximum launch angle from vertical
d=2; //drag coeffecientbirth=effect(“life”).param(“Point”)[0];
life=effect(“life”).param(“Point”)[1];
origin=[position[0],position[1],position[2]];
age=time-birth;
seed_random(1,true);
s=random(vmin,vmax);//initial speed
g=random(gmin,gmax);
v_e=this_comp.layer(“Null 1”).position.velocity_at_time(birth); //emitter velocity
a=degrees_to_radians(random(amin,amax)); //angle from vertical
r=degrees_to_radians(random(360)) //rotation around y axis
x=s*Math.sin(a)*Math.cos(r);
y=-s*Math.cos(a);
z=s*Math.sin(a)*Math.sin(r);
v=[x,y,z]+v_e;
new_speed=length(v);
unit_v=normalize(v);if (d>0){
delta_p=new_speed*(1-Math.exp(-d*age))/d;
}else{
delta_p=age*new_speed;
}
delta_w=w*age;
delta_g=g*age*age/2;wa=degrees_to_radians(wdir);
origin + delta_p*unit_v + [delta_w*Math.cos(wa),0,delta_w*Math.sin(wa)] + [0,delta_g,0]
Orientation
rmax=0;
rmin=-0;
birth=effect(“life”).param(“Point”)[0];
life=effect(“life”).param(“Point”)[1];
age=time-birth;
if (life==0){
[0,0,0]
}else{
seed_random(birth,true);
init_orient=random([360,360,360]);
final_orient=(init_orient);
init_orient +(final_orient-init_orient)*(age/life)
}X Rotation
rmax=360; //maximum rotation
rmin=-360; //minimum rotationbirth=effect(“life”).param(“Point”)[0];
seed_random(1,true);
r=random(rmin,rmax);
life=effect(“life”).param(“Point”)[1];
age=time-birth;
if(life==0){
0
}else{
r/life*age
}Y Rotation
rmax=360; //maximum rotation
rmin=-360; //minimum rotationbirth=effect(“life”).param(“Point”)[0];
seed_random(1,true);
r=random(rmin,rmax);
life=effect(“life”).param(“Point”)[1];
age=time-birth;
if(life==0){
0
}else{
r/life*age
}Z Rotation
rmax=360; //maximum rotation
rmin=-360; //minimum rotationbirth=effect(“life”).param(“Point”)[0];
seed_random(1,true);
r=random(rmin,rmax);
life=effect(“life”).param(“Point”)[1];
age=time-birth;
if(life==0){
0
}else{
r/life*age
}