Skip to main content
Participant
May 11, 2022
Question

Rotate shapes based on gradient

  • May 11, 2022
  • 1 reply
  • 153 views

Hello,

 

I am a total expressions noob. I am trying to rotate a number of small shapes that rotate in waves with respect to a gradient layer behind it.

 

I've followed this tutorial which is what I want, but with scale instead of gradient:

https://www.youtube.com/watch?v=96ZM-s6yHEg

 

He uses the expression:

x = thisComp.layer("Gradient").sampleImage(transform.position, [.5,.5]/2, true, time)[0];
100*[x,x]

 

If I insert this into the Rotation field, I get the error "Expression must be of dimension 1, not 2". Where am I going wrong?

 

Many thanks!

 

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
May 11, 2022

I'd try something like this:

x = thisComp.layer("Gradient").sampleImage(transform.position, [.5,.5]/2, true, time)[0];
180*(x-.5)