Skip to main content

rotation effect

5 replies [Last post]
lgranie
Offline
Joined: 2006-04-29
Points: 0

Hi,

Here the code :
PropertySetter modifier = new PropertySetter(triangle, "angle", 1f, 0f);
Animator timer = new Animator(500, modifier);
timer.start();

triangle is a instance of :
public class Triangle implements Renderable {

public float angle = 0.0f;

public Triangle() {
super();
// TODO Auto-generated constructor stub
}

public void render(GLAutoDrawable drawable) {
GL gl = drawable.getGL();

gl.glLoadIdentity();
gl.glTranslatef(-1.5f, 0.0f, -6.0f);
gl.glRotatef(angle, 0.0f, 1.0f, 0.0f);
gl.glBegin(GL.GL_TRIANGLES); // Drawing Using Triangles
gl.glColor3f(1.0f, 0.0f, 0.0f); // Set the current drawing color to red
gl.glVertex3f(0.0f, 1.0f, 0.0f); // Top
gl.glColor3f(0.0f, 1.0f, 0.0f); // Set the current drawing color to green
gl.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left
gl.glColor3f(0.0f, 0.0f, 1.0f); // Set the current drawing color to blue
gl.glVertex3f(1.0f, -1.0f, 0.0f); // Bottom Right
gl.glEnd(); // Finished Drawing The Triangle
}

public float getAngle() {
return angle;
}

public void setAngle(float angle) {
this.angle = angle;
}
}

When I execute that code, my triangle does not rotate and I ve got this error :
Exception in thread "main" java.lang.IllegalArgumentException: No Evaluator can be found for type class java.lang.Object; consider using different types for your values or supplying a custom Evaluator
at org.jdesktop.animation.timing.interpolation.Evaluator.create(Evaluator.java:123)
at org.jdesktop.animation.timing.interpolation.KeyValues.(KeyValues.java:105)
at org.jdesktop.animation.timing.interpolation.KeyValues.create(KeyValues.java:83)
at org.jdesktop.animation.timing.interpolation.PropertySetter.(PropertySetter.java:228)
at org.ambiance.desktop.GLAmbianceDesktop.start(GLAmbianceDesktop.java:149)

Someone to help me,
Thanks, Laurent.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
lgranie
Offline
Joined: 2006-04-29
Points: 0

The following code produce the same effect :
public class TimingFramework extends TestCase {

private float f = 0.0f;

public void testPropertySetter() {
PropertySetter modifier = new PropertySetter(this, "f", 0f, 360f*8f);
Animator timer = new Animator(2000, modifier);
timer.start();
}
}

Did I miss something?

I use java 1.5.0_06 and TimingFramework-0.56.jar.

Thanks

rah003
Offline
Joined: 2004-05-26
Points: 0

> Did I miss something?
>
> I use java 1.5.0_06 and TimingFramework-0.56.jar.
>
> Thanks

This code works fine for me (after adding setter/getter for the "f") on almost same JDK (1.5.0_07) and version of timing framework. Any chance of having some older version of framework on the classpath or having IDE (in case you were running it from one) interfering?

lgranie
Offline
Joined: 2006-04-29
Points: 0

I upgrade my eclipse (3.1 => europa) and now it's work fine.

Thanks for all.

rah003
Offline
Joined: 2004-05-26
Points: 0

> Here the code :
> PropertySetter modifier = new PropertySetter(triangle, "angle", 1f, 0f);

Did you really copy&paste this line from your source? The exception below seems not to match it.

> Exception in thread "main" java.lang.IllegalArgumentException: No Evaluator can
> be found for type class java.lang.Object; consider using different types for your values or supplying a
> custom Evaluator

This is what you get most often when types of the params you have passed in in the PropertySetter constructor are not of the same type ... then most common ancestor for both is used ... which most of the time is Object. Any chance you are passing in combination of primitive float and Object of type Float?

Jan

lgranie
Offline
Joined: 2006-04-29
Points: 0

This is the only code. The Exception is throwed when the line is called.

I try to execute the BezierAnim3D demo : I've got the same error.