Skip to content
This repository has been archived by the owner on Mar 19, 2020. It is now read-only.
This repository has been archived by the owner on Mar 19, 2020. It is now read-only.

Short animated duty cycle causes animation repeat #8

Closed
pardom-zz opened this issue Oct 2, 2015 · 1 comment
Closed

Short animated duty cycle causes animation repeat #8

pardom-zz opened this issue Oct 2, 2015 · 1 comment

Comments

@pardom-zz
Copy link

I'm seeing some repeats in animation when I set the animated duty cycle to <= 0.5. And I think this is due to using Math.max() to limit the interpolated value. When the animation range is small enough, the time is interpolated to fit more than one sine wave.

According to the method doc ("Sets the fraction of the animation loop time spent actually animating. The rest of the time will be spent "resting"), it seems that this:

double radians = (input / animRange) * Math.PI;
double interpolatedValue = Math.max(0f, Math.sin(radians));
return (float) interpolatedValue;

Should actually be this:

if (input > animRange) return;
double radians = (input / animRange) * Math.PI;
double interpolatedValue = Math.sin(radians);
return (float) interpolatedValue;

Thoughts?

@rock3r
Copy link
Contributor

rock3r commented Oct 3, 2015

That would work, if you wanted to change the behaviour of the animation. I suppose the documentation might be a bit misleading given what the code actually does... Will issue a minor update to address this.

@rock3r rock3r closed this as completed in d5c7028 Oct 3, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants