FORUMS: list search recent posts

rotation/revolution and opacity

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Michael Mendelsohn
rotation/revolution and opacity
on Apr 23, 2013 at 1:07:12 pm

Hi list...

I'm trying to create a relationship between a null's rotation and some opacity elsewhere. I read some of Dan Ebbert's responses, but I can't seem to get mine to take revolutions into account.

Here's what I have, but when I come back around one full revolution, it doesn't work.

I'd appreciate any hints. This should be simple, I think.

- Michael M.

var a = 0;
var revs = parseInt((thisComp.layer("master null").transform.yRotation/360)%360);
var offset = (revs == 0)?0:360;
var r = Math.abs(offset - thisComp.layer("master null").transform.yRotation)%360;
var d = Math.abs(a-r);
ease(d, 10,36, 100,0);


Return to posts index

Dan Ebberts
Re: rotation/revolution and opacity
on Apr 23, 2013 at 4:22:07 pm

What's the relationship you're trying to create? I'm sure it's in there somewhere, but it might be simple if you spell it out.

Dan



Return to posts index

Michael Mendelsohn
Re: rotation/revolution and opacity
on Apr 23, 2013 at 5:31:19 pm

Hi Dan, thanks very much for responding. I really appreciate it.

I have a master null and 4 "satellite" nulls parented to the master, initially set to 0, 90, 180 and 270 degrees respectively. Each of these 4 nulls have a few layers parented to them. These layers' opacity is tied to its parent null. All 5 nulls are at the same position.

I've rotated the master null with keyframes, which rotates the satellite nulls and their children (like a baby's mobile). The whole apparatus is like a cube.

The relationship I'm trying to make is that there should be a range where each face of the cube is 100% opacity when facing the camera, fading in as it approaches an angle (var a), and fades out as it moves away from that angle. My code works, but only for the first revolution, then it breaks. I have a text layer outputting my variable values. I'm just not sure how to tweak the code to make it work after the first 360 degrees.

My code on the opacity property on each of the satellite nulls, with added comments:

// on each satellite null's opacity. Children layers' opacity is pickwhipped to this value.
// this null's parent is "master null"
// a is either 0, 90, 180 or 270
var a = 180;
var r = (thisComp.layer("master null").transform.yRotation)%360;
var d = Math.abs(a-r);
ease(d, 10,36, 100,0);


Return to posts index


Dan Ebberts
Re: rotation/revolution and opacity
on Apr 23, 2013 at 6:23:08 pm

I just tried your expression and it works fine (handles multiple revolutions) for positive rotation values, but to get it to work for negative rotation I had to change the second line to this:

var r = Math.abs((thisComp.layer("master null").transform.yRotation)%360);


Dan



Return to posts index

Michael Mendelsohn
Re: rotation/revolution and opacity
on Apr 24, 2013 at 2:42:24 pm

Thanks, Dan! I really appreciate hearing from you!


Return to posts index

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