Page 1 of 1

Slider with Animation Engine

Posted: Fri Jun 22, 2012 11:49 am
by vladoportos
Hello all,

I have been on this for better part of today and was unsuccessful :cry:

I'm trying to do custom slider similar to example for Animation Engine plugin ( yes I'm using AE )

But in the example is used constrainRectangular to constrain movement of slider into the slider background.

In my case the background is smaller than the slider and if I use the same constrainRectangular it will move the slider slightly higher than the background so it looks like ( see attachement ) which is not desirable :-/

So I changed it to constrainLinear and will get the position of background do some math to get first point and second point and set it to it..

I have put the code in button so I can test it, it looks like this:

Code: Select all

on mouseUp
   put first item of loc of image "pPozadie" into x --pPozadie is backboard 
   put second item of loc of image "pPozadie" into y
   put x-22 into x1 --get the start point of line I want to move it on
   put x+22 into x2 -- get the last point of line
   put y+7 into y -- move it little bit down so it is centered ( the nob )
   set the constrainLinear of image "posuvak" to x1,y,x2,y  --posuvak is the shuffle nob
end mouseUp
when I press the button and than click and move the nob it is where it should be and all is fine.

PROBLEM:

The whole stack is resizable, and the background can move so I need to automatically set the nob to correct path, so I was thinking
that I put the same code that is in button to resizeControl so it will update the coordinates every time app is resized.

Code: Select all

on resizeControl
   doFitImg -- here it calls the same code that is in button above ..
pass resizeControl
end resizeControl
but it doesn't work behavior is best described as passing the last position before the new, its almost never in the correct position on the background...

What I want to do is to have that slider with just two position on the left and the right, so when user moves it to the right it enable button for DB deletion ( or dome something ) and when it moves it back button gets disabled ( or other thing happen ).

Any help would be great, for sample code I will buy you a beer ! :P

Re: Slider with Animation Engine

Posted: Fri Jun 22, 2012 12:42 pm
by Klaus
Hi Valdimir,

sorry, never worked with AE so far, but will move this thread to the correct forum: Animation Engine 8)


Best

Klaus

Re: Slider with Animation Engine

Posted: Fri Jun 22, 2012 2:07 pm
by bn
Hi Vladimir,

the object does not get a resizeObject message when the object is resized by a script. (see dictionary -> resizeObject)

you probably could put a resizeStack handler in the card like this:

Code: Select all

on resizeStack
   doFitImg -- here it calls the same code that is in button above ..
   pass resizeStack
end resizeStack
that should work since the resizeStack message is sent when the stack is resized.

Kind regards
Bernd

Re: Slider with Animation Engine

Posted: Sun Jun 24, 2012 3:50 pm
by vladoportos
Thanks Bern I will try that out.