Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
ADOBE AFTER EFFECTS:HomeForumBasicsExpressionsTutorialsPodcastsAE TechniquesTrainingCreative Cloud DebateFAQ

Re: Creating an ocean of text layers, all reacting to a displacement map

COW Forums : Adobe After Effects Expressions

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Share on Facebook
Respond to this post   •   Return to posts index   •   Read entire thread


Chris MellorRe: Creating an ocean of text layers, all reacting to a displacement map
by on Apr 27, 2012 at 4:03:06 pm

Thanks so much Dan! Although I am not quite sure how arctangent2 works... it works! Unfortunately these expressions are now causing AE to act really buggy. Sometimes the program crashes, but more often, I get a "Timeout while waiting for engine" error. Sounds to me like there is some kind of infinite loop problem, but I can't imagine where.
If someone could look over my code and give me some feedback, that would be great. Maybe there are some redundancies or simple syntax errors I am overlooking.
Here is the code for the Position value of my word layer, remember this is one layer meant to be duplicated 500+ times:
leader = thisComp.layer("Attractor"); // null layer

// spacial offset from null
seedRandom(index, true);
offsetX = random(0,20)*thisComp.layer("Spacial Slider").effect("X")("Slider")*thisComp.layer("Spacial Slider").effect("XYZ")("Slider");
offsetY = random(-20,20)*thisComp.layer("Spacial Slider").effect("Y")("Slider")*thisComp.layer("Spacial Slider").effect("XYZ")("Slider");
x = leader.position[0] + offsetX*time; // the *time makes it so it is always moving, so the atan2() in the rotation expression is never dividing by 0
y = leader.position[1] + offsetY;

// z bump
zMin = thisComp.layer("Wave Height Sliders").effect("zMin")("Slider");
zMax = thisComp.layer("Wave Height Sliders").effect("zMax")("Slider");
target = thisComp.layer("Turbulence Layer");
samplePoint = [Math.abs(x),Math.abs(y)];
sampleRadius = [5,5];
rgb = target.sampleImage(samplePoint, sampleRadius);
lum = rgbToHsl(rgb)[2];
offsetZ = ease(lum, 0, 1, zMin, zMax)*thisComp.layer("Spacial Slider").effect("Z")("Slider");
z = leader.position[2] + offsetZ;

[x, y, z]


and the zRotation expression looks like this:
p1 = position;
p2 = position.valueAtTime(time-thisComp.frameDuration*5);
delta = p1-p2;

radiansToDegrees(Math.atan2(delta[2],delta[0]))


Does this all make sense? Is there a smarter way I could write this so AE doesn't get confused reading it??

-Chris


Posts IndexRead Thread
Reply   Like  
Share on Facebook


Current Message Thread:




LOGIN TO REPLY



FORUMSTUTORIALSMAGAZINESTOCKYARDVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2013 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]