Custom easing functions in transition.to

Hi,

transistion.to is great and the out of the box easing function are great also…

However, out of the preset ones i can’t quite get the effect I want. After reading the docs here:

http://docs.coronalabs.com/api/library/easing/index.html

it mentions the built in ones are based on Robert Penner’s easing functions

I had a play on the function generator and came up with a couple that suit my needs better.

 http://www.timotheegroleau.com/Flash/experiments/easing_function_generator.htm

I had a play trying to get a custom one working but im not sure what my function needs to accept and return to get it to work.  

This is a function as generated from the link above:

function(t, b, c, d) { var ts=(t/=d)\*t; var tc=ts\*t; return b+c\*(tc\*ts + -5\*ts\*ts + 10\*tc + -10\*ts + 5\*t); }

so in corona speak I thought I could just do this:

-- approx conversion local function myEasing(t, b, c, d) local ts=(t/d)\*t local tc=ts\*t return b+c\*(tc\*ts + -5\*ts\*ts + 10\*tc + -10\*ts + 5\*t) end transition.to( target, { transition=myEasing } )

Is there some documentation anywhere that i’ve missed? if not, has anybody got a working example so i can see how custom ones are created?

thanks!

I haven’t played with custom easing myself but I did come across this library a while back. It might give you some insight on how custom easing is achieved.

easingx.lua

Hi Vince,

I appreciate the reply but I don’t think that is what im looking for.

I want to be able to use the built in corona transition.to  but just point the tranisition parameter to my own funciton.

I think this is a question for corona staff as they can see how the method for say “inBounce” looks and the parameters it accepts and returns.

Once i know that, i should be able to put my own formula in 

http://www.webdevils.com/corona-more-easing-types/

Hey David, I’m on my phone so it’s hard to go into detail but that’s how the easingx.lua library is supposed to work.

Check out the link above for more information

why not put a print inside the easing function and make sure you are getting the values expected passed in.

I haven’t played with custom easing myself but I did come across this library a while back. It might give you some insight on how custom easing is achieved.

easingx.lua

Hi Vince,

I appreciate the reply but I don’t think that is what im looking for.

I want to be able to use the built in corona transition.to  but just point the tranisition parameter to my own funciton.

I think this is a question for corona staff as they can see how the method for say “inBounce” looks and the parameters it accepts and returns.

Once i know that, i should be able to put my own formula in 

http://www.webdevils.com/corona-more-easing-types/

Hey David, I’m on my phone so it’s hard to go into detail but that’s how the easingx.lua library is supposed to work.

Check out the link above for more information

why not put a print inside the easing function and make sure you are getting the values expected passed in.