Skip to main content

Discrete Repeating Animator Trouble

1 reply [Last post]
Joined: 2005-09-16

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?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-09-16

Well I figured out part of the problem, I did not specify a repeat count.

I still would like to find a way that the timingevent would not fire multiple times per discrete value. This seems to cause a lot of unnecessary instructions on the EDT.