AE ENHANCERS

Expressions/Scripts/Presets
It is currently Sun Apr 20, 2014 6:18 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Moving by increments of 10 pixels
PostPosted: Mon Jan 14, 2008 5:53 pm 
Offline
User avatar

Joined: Sat Jun 05, 2004 8:05 am
Posts: 137
Location: Los Angeles, CA
I've got an arrow that drives the movement of a rectangle. I need the arrow to move freeform, but the rectangle to look like it is snapping to a grid made of 10x15 rectangles. Is there a way to make the movement of the rectangle follow the arrow but still constrain to the grid?

Thanks
Alex


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 14, 2008 6:08 pm 
Offline

Joined: Sat Jun 26, 2004 10:01 am
Posts: 304
Location: Folsom, CA
Something like this maybe:

w = 10;
h = 15;

offset = [w,h]/2;

[Math.floor(value[0]/w)*w, Math.floor(value[1]/h)*h] + offset;


You'll probably want to fiddle with the offset til you get what you want.

Dan

_________________
http://www.motionscript.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group