rotate a object proportionally to a variable... how can i do?
in
Programming Questions
•
2 years ago
Hello everyone,
I have a little problem:
I would like to map a value read from the serial port by rotating, in this case, a svg in proportion to the value measured.
Something like the speedometer of a car.
The problem is that the command rotate (); adds degrees (radians) in each loop, to the number of degrees recognized in the precedents loops.
Example: if for two consecutive readings I have 60 degrees, I wish that the subject remained rotated at 60 degrees.
Instead the degrees becomes 120, then 180 and so on ...
I tried using a variable that subtract the old to the new survey, but without success.
How can I do?
Thanks
Something like the speedometer of a car.
The problem is that the command rotate (); adds degrees (radians) in each loop, to the number of degrees recognized in the precedents loops.
Example: if for two consecutive readings I have 60 degrees, I wish that the subject remained rotated at 60 degrees.
Instead the degrees becomes 120, then 180 and so on ...
I tried using a variable that subtract the old to the new survey, but without success.
How can I do?
Thanks
2