Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Converting a point control to a slider
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
navarro_par...@adobeforums.com  
View profile  
 More options Feb 5, 6:12 pm
Newsgroups: adobe.after.effects.expressions
From: Navarro_Par...@adobeforums.com
Date: Thu, 5 Feb 2009 15:12:51 -0800
Local: Thurs, Feb 5 2009 6:12 pm
Subject: Converting a point control to a slider
Some old plug-ins like Linear Wipe have a simple percentage slider to control the amount of wipe. However, I'd like to align a linear wipe with a motion tracked point.

How can I convert XY data into a 0~100% slider value? Would the expression assume the dimensions of the comp or the layer to ensure proper alignment?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
aaron_c...@adobeforums.com  
View profile  
 More options Feb 6, 12:22 am
Newsgroups: adobe.after.effects.expressions
From: Aaron_C...@adobeforums.com
Date: Thu, 5 Feb 2009 21:22:07 -0800
Local: Fri, Feb 6 2009 12:22 am
Subject: Re: Converting a point control to a slider
Is the idea that the linear wipe should intersect the point at a given angle?

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rick_ger...@adobeforums.com  
View profile  
 More options Feb 6, 12:40 am
Newsgroups: adobe.after.effects.expressions
From: Rick_Ger...@adobeforums.com
Date: Thu, 5 Feb 2009 21:40:03 -0800
Local: Fri, Feb 6 2009 12:40 am
Subject: Re: Converting a point control to a slider
I'm not exactly sure that I follow what you're trying to do. If you want to take the x position value and use that to vary a value between 0 and 100 you might try something like this:

      x = transform.position[0];
      p = linear(x, 0, thisComp.width, 0, 100);
      p

What I've done is to take the x position value of the layer and use the linear interpolation method to interpret the total width of the comp to 100. You could also perform the task by using x position/width*100. This would return the X position as a percentage of the comp width but would not limit the value to 100%.

I hope this helps.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
aaron_c...@adobeforums.com  
View profile  
 More options Feb 6, 12:05 pm
Newsgroups: adobe.after.effects.expressions
From: Aaron_C...@adobeforums.com
Date: Fri, 6 Feb 2009 09:05:15 -0800
Local: Fri, Feb 6 2009 12:05 pm
Subject: Re: Converting a point control to a slider
Here's what I've come up with:

L = thisComp.layer("Null 1");
controlPoint = fromComp(L.toComp(L.transform.anchorPoint));     //sub in target point here
theta = degreesToRadians(effect("Linear Wipe")("Wipe Angle"));      //get angle
m = Math.tan(theta)*source.pixelAspect; //get slope of line defined by wipe

//get determinates for anchor line
if(m < 0) {          a1 = [0, 0];    a2= [width, height]  } else {   a1 = [0, height];       a2 = [width, 0];  }

//get determinates for wipe line
b1 = controlPoint;
b2 = b1+[1/m, 1]

//define individual variables for (slightly better) readability
x1 = a1[0];
y1 = a1[1];
x2 = a2[0];
y2 = a2[1];
x3 = b1[0];
y3 = b1[1];
x4 = b2[0];
y4 = b2[1];

//get point of intersection (this was transcribed straight from <http://en.wikipedia.org/wiki/Line-line_intersection)>
P = [   ( (x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4) ) / ( (x1-x2)*(y3-y4)-(y1-y2)*(x3-x4) ) , ( (x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4) ) / ( (x1-x2)*(y3-y4)-(y1-y2)*(x3-x4) ) ]

linear(length(P, a1), 0, length(a1, a2), 0, 100)        //now turn the point of intersection into a percentage


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
aaron_c...@adobeforums.com  
View profile  
 More options Feb 6, 12:58 pm
Newsgroups: adobe.after.effects.expressions
From: Aaron_C...@adobeforums.com
Date: Fri, 6 Feb 2009 09:58:15 -0800
Local: Fri, Feb 6 2009 12:58 pm
Subject: Re: Converting a point control to a slider
Okay, trying that again.

Here's what I've come up with:

L = thisComp.layer("Null 1");
controlPoint = fromComp(L.toComp(L.transform.anchorPoint));     //sub in target point here
theta = (effect("Linear Wipe")("Wipe Angle")+100000*360)%360;       //get angle
m = Math.tan(degreesToRadians(theta))*source.pixelAspect; //get slope of line defined by wipe

//get determinates for anchor line
if(theta < 90) {

        a1 = [0, height];

        a2 = [width, 0];

} else if(theta < 180) {     a1 = [0, 0];

        a2= [width, height];

} else if(theta < 270){

        a2 = [0, height];

        a1 = [width, 0];

} else {

        a2 = [0, 0];

        a1= [width, height];

}

//get determinates for wipe line
b1 = controlPoint;
b2 = b1+[1/m, 1]

//define individual variables for (slightly better) readability
x1 = a1[0]; y1 = a1[1]; x2 = a2[0]; y2 = a2[1]; x3 = b1[0]; y3 = b1[1]; x4 = b2[0]; y4 = b2[1];

//get point of intersection (this was transcribed straight from <http://en.wikipedia.org/wiki/Line-line_intersection)>
P = [   ( (x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4) ) / ( (x1-x2)*(y3-y4)-(y1-y2)*(x3-x4) ) , ( (x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4) ) / ( (x1-x2)*(y3-y4)-(y1-y2)*(x3-x4) ) ]

if(length(P, a2) < length(a2, a1)) linear(length(P, a1), 0, length(a1, a2), 0, 100)  //now turn the point of intersection into a percentage  else 0

Sub in your layer name for "Null 1", or make your own assignment to controlPoint.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
navarro_par...@adobeforums.com  
View profile  
 More options Feb 10, 5:35 pm
Newsgroups: adobe.after.effects.expressions
From: Navarro_Par...@adobeforums.com
Date: Tue, 10 Feb 2009 14:35:15 -0800
Local: Tues, Feb 10 2009 5:35 pm
Subject: Re: Converting a point control to a slider
Whoa! Thanks man! I'll try it out!

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google