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

Clamping x position on after effects

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook

Gabriel RochaClamping x position on after effects
by on Oct 8, 2012 at 8:42:13 pm

hello,
Is there a way to clamp a X Position opn after effects on several different values?
I've been using this code:

x1=1024.3322
x2=1224.1572
clamp(transform.xPosition,x1,x2)
if (transform.xPosition>x1) {
transform.xPosition=x2;
}

But that only allows me to snap from one position to another. I'd like to be able to snap into 6 positions (on X dimension).
is there a way to do that?
I use the Snaped position to get the position value and use in another layer but i really need to be clamped.
Thanks,

GR


Return to posts index
Reply   Like  
+1


Dan EbbertsRe: Clamping x position on after effects
by on Oct 8, 2012 at 8:56:41 pm

Something like this should work:

xVals = [1024,1224,1444,1624,1824,2024];
i = 0;
while (value > xVals[i] && i < (xVals.length-1)) i++;
xVals[i]


Dan



Return to posts index
Reply   Like  
+1

Gabriel RochaRe: Clamping x position on after effects
by on Oct 9, 2012 at 12:54:37 pm

Hey Dan,
I knew you would come for the Help.
Right now for some reason it's not working.
im not sure if i made myself 100% clear.
Check the file i uploaded as an example of what i have now. Just slide the layer to On and OFF.
Download the AEP here:
http://www.sendspace.com/file/gjj1pi

But instead of ON and OFF i would have Value 1, Value, 2 Value 3, Value 4...
Im adding your code on the xPosition but i get the Layer stuck in one single position.
Thanks again for your help!

http://www.gabrielrocha.com


Return to posts index
Reply   Like  


Gabriel RochaRe: Clamping x position on after effects
by on Oct 9, 2012 at 12:57:45 pm

ok forget about it.
The code you sent wasn't working on my original Project, but its working on a plain project (like the one i uploaded). SO it must be something on my previous project.
I'll check it out! Thanks man. You rock!

http://www.gabrielrocha.com


Return to posts index
Reply   Like  

Gabriel RochaRe: Clamping x position on after effects
by on Oct 10, 2012 at 8:23:19 pm

Hey Dan,
What if i want to slide a layer on the xPosition, but having a limitation.
Let`s say i want to slide it from 1024 to 1530, not clamping just being able to slide from 1024 to 1530, limiting the beginning and the end to those values?
I`ve found similar possibilities, but none quite the same here on CC.
THanks again in advance,

GR

http://www.gabrielrocha.com


Return to posts index
Reply   Like  

Dan EbbertsRe: Clamping x position on after effects
by on Oct 10, 2012 at 8:36:56 pm

Are you talking about something different than just right-clicking on the slider value in the Effect Controls window and setting the slider range?

Dan



Return to posts index
Reply   Like  


Gabriel RochaRe: Clamping x position on after effects
by on Oct 10, 2012 at 8:42:33 pm

Yes, i want to do that on the Viewport.
I know about the slider, checkbox and stuff on the Effects tab, but i want to do that on the viewport. you know what i mean?

http://www.gabrielrocha.com


Return to posts index
Reply   Like  


Dan EbbertsRe: Clamping x position on after effects
by on Oct 10, 2012 at 8:57:27 pm

> you know what i mean?

Sorry, I'm not sure. By "Viewport" do you mean the Comp window?

If you're talking about an expression that would keep you from dragging a layer outside that range, that be a clamping expression for X Position like this:

clamp(value,1024,1530)

If not, I'm not sure what you're trying to do.

Dan



Return to posts index
Reply   Like  
+1

Gabriel RochaRe: Clamping x position on after effects
by on Oct 10, 2012 at 9:01:24 pm

Actually that's perfect.
I didn't know Clampping would give me that result.
I thought that clamping would be more like snapping.
THanks again man, that helped!

http://www.gabrielrocha.com


Return to posts index
Reply   Like  

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook


FORUMSTUTORIALSMAGAZINESTOCKYARDVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

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

[Top]