I have a 2Dshape and I want to rotate it by a variable angle, say "theta", which I have already declared in the variables panel.
So I try to input my variable to the dialog box that accompanies the cell "Transform". I type "theta", in the cell next to the button "Rotation" and press the button. The line on the bottom reads "ro:thetad" which seems to me wrong syntax and it appears that it actually is, because in the output area reads
"Incorrect value for transformation: ro:thetad java.lang.NumberFormatException:For input string:"theta" at.sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1242) .... ..." many more lines, you get the idea
and of course it's not rotating when I run the simulation.
I can't figure out what's wrong with the syntax, as my programming skills are below average and I have little knowledge of java .
The Transform property can be very sophisticated, if you use the dialog to add more than one transformation.
But it can also be very simple!
Just type "theta" or use the 'link' icon to link it to that variable.
That should do it. (Notice that if theta is a double variable, its value is considered to be in radians. If it is an int variable, the value is taken in degrees.)
Paco
PS: If you use the dialog for transformations, the right syntax would be: "ro:"+theta+"d". Thsi builds a string that EJS can later reinterpret as a rotation.
But if all you want is a rotation, a simple variable is enough.
I just typed "theta" and it worked ok and I think that will do for my simulation.
I also tried to follow the more complicated way so, I opened the dialog of the "Transform" cell and typed in the last line "ro:"+theta+"d". When I run the simulation, my shape doesn't rotate. That's not a real problem for me cause I achieved the rotation the easy way.