Posted by jackdog
on January 17, 2008 at 12:53 PM PST
I am attempting to create an animation that uses discrete steps for each part. Currently I do not have discrete steps and the EDT is getting swamped. I have 5-6 of these running at once and the volume of repaints is very large.
To get around this, I would like to create an animator that only paints at most 5 times per duration (500ms) and have it honor RepeatBehavior.REVERSE. I might tweak the steps per duration for aesthetics. If the EDT still gets swamped at 5 times per 500ms, I might lower the steps to 4.
What I tried is:
KeyValues keyValues = KeyValues.create(.5f,.6f,.7f,.8f,.9f,1.0f);
KeyTimes keyTimes = new KeyTimes(0f,.2f,.4f,.6f,.8f,1.0f);
KeyFrames frames = new KeyFrames(keyValues,keyTimes,DiscreteInterpolator.getInstance());
Animator a = PropertySetter.createAnimator(700, getRenderer(event), "alpha",frames);
This mostly works, however it does not repeat at all. It runs once and quits. I put a check in my alpha setter so the component will only repaint if the alpha changes. That check probably still keeps too many instructions on the EDT. Any suggestions on how to correctly do this?