Jump to content
Sign in to follow this  
Beaver

5 expressions that will change your life

Recommended Posts

I guess I want to bump this thread because I re-visit too many time not to say: thanks!

 

We should so make this sticky. I always end up searching for it whenever I forget to bring my drive with me to a job.

Share this post


Link to post
Share on other sites

Really, really simple one liner but I use it a lot, and I didn't even know the function existed until a month or so back. It returns the z-axis orientation of a layer, relative to the comp camera. Divided by 5 here, but change this number to suit your style. Positive means it faces the camera, negative means facing away.

 

When do I use it? To drive the opacity of a screen object on a device, usually a mobile phone. So you've got a nice 3D rendered spinning phone, doing the usual spins in space, flipping this way and that, and some separate screen content, showing off some feature of the device's UI. You want the screen to be 100% opaque when it's facing the camera, 100% transparent when it's facing away and have a nice fall off when it goes past around 70°, so it looks like the screen content is dimming as the viewing angle. This does that. Change the 5 to control how the angle affects the brightness of the screen.

thisLayer.toCompVec([0, 0, 1])[2]/5;

Share this post


Link to post
Share on other sites

 

You want the screen to be 100% opaque when it's facing the camera, 100% transparent when it's facing away and have a nice fall off when it goes past around 70°, so it looks like the screen content is dimming as the viewing angle.

 

Slick. I will definitely be trying this out the next time one of those projects is in.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...