Activity › Forums › Adobe After Effects Expressions › getting cursor X and Y position
-
getting cursor X and Y position
Posted by Nicholas Joseph on March 2, 2011 at 8:51 pmHello everyone…
I am trying to wright an expression that moves a null/solid to the position of the cursor when it in the comp window. I want the solid to lock onto the cursor. This is so I can attach pixel stats/ rgb info as a text that follows the cursor around.
Can someone please help
Thanks
—–
NIK
—–Nicholas Joseph replied 15 years, 2 months ago 2 Members · 2 Replies -
2 Replies
-
Dan Ebberts
March 2, 2011 at 9:25 pmExpressions don’t have any way to detect the position of the cursor. There may be another way to achieve what you want, but I don’t really understand what your end objective is.
Dan
-
Nicholas Joseph
March 3, 2011 at 6:46 pmHi Dan
Thanks for the response. 🙂I’m doing some stereoscopic work and I’m having trouble or should I say the client is having trouble seeing the pixel depth amounts that are set.
So I created a script that will create a white dot… 1pixel X 1 pixel which sits with the original footage. When I add the 3d glasses effect at the end of the displacement setup and stuff..That white dot becomes a RED and a BLUE dot(because of the 3dglasses and displacement). The distance between those 2 dots equals the amount of pixel depth.(so foreground elements the dots are closer to each other and BG they are further away) What I am trying to do…is some how find the RED and BLUE dots in a comp (its on a black solid so they are the only 2 pixels in the entire comp) and measure the distance.(only the horizontal distance)
What I was hoping is if I can get the cursor location and hook it up to the white dot so that the dot follows the cursor and gives feed back to a textLayer that shows the depth at the location of the cursor…but I am having trouble measuring the distance between the 2 dots now. Having the dot follow the mouse is going to be really slow because the comp is very heavy..so I have abandon that and just attached the dot to a Null…which works well.
Do you know how I can measure the distance between the 2 pixels…
I tried the sampleImage() but it gives me the color at a point instead of the location of the color in a comp.I’m hoping for something like….
PixelRED = search the area for pixel with value RED <>
LocationOfRedPixel = X and Y positionPixelBLUE = search the area for pixel with value BLUE <>
LocationOfBLUEPixel = X and Y positiontext = LocationOfRedPixel.X – LocationOfBLUEPixel.X
Is that possible with scripting and expressions? I am reading up on pixelBlender for more answers…but any you can offer would be super awesome!
Thanks Again,
Reply to this Discussion! Login or Sign Up
