16
General / scale animation problem
« on: April 05, 2016, 01:37:19 am »
hello
i'm having trouble time with scale animation which i thought it will be most easiest part in my game that i'm working on. but it turned i was wrong about it.
my goal is to achieve smooth and constant scaling animation. i have implemented the "easing" technique to calculate ratio of scale amount that need to step each frame to sprite object. it seems run but i didn't get what i was looking for. the scaling effect is varying from time to time which is not suppose to happen. some time it goes faster while other goes slower.
also, i have faced problem with float point comparison that i can't compare two float values for equality with if statement, i had to implement "close enough" approach.
i have created minimal example to demonstrate the issue:
my questions
how can i fix this tripping in animation?, is my implementation is correct? and are there other ways to achieve smooth and constant scale animation?
Edit: i fixed it, my bad, it was a bug in both source code. i corrected example here and code in my game both work fine at last but it seems i overly complicated it for just scaling , i'm sure there is an easy way to do it, but i don't know it.
is there a better way to do scale animation?
i'm having trouble time with scale animation which i thought it will be most easiest part in my game that i'm working on. but it turned i was wrong about it.
my goal is to achieve smooth and constant scaling animation. i have implemented the "easing" technique to calculate ratio of scale amount that need to step each frame to sprite object. it seems run but i didn't get what i was looking for. the scaling effect is varying from time to time which is not suppose to happen. some time it goes faster while other goes slower.
also, i have faced problem with float point comparison that i can't compare two float values for equality with if statement, i had to implement "close enough" approach.
i have created minimal example to demonstrate the issue:
(click to show/hide)
my questions
how can i fix this tripping in animation?, is my implementation is correct? and are there other ways to achieve smooth and constant scale animation?
Edit: i fixed it, my bad, it was a bug in both source code. i corrected example here and code in my game both work fine at last but it seems i overly complicated it for just scaling , i'm sure there is an easy way to do it, but i don't know it.
is there a better way to do scale animation?