I am attempting create a BC (Bluetooth Controlled) 1/32 scale SEMI Track Transport, for my 1/32 scale slot cars and ETRC slot trucks.
I am trying to animate a steering wheel .png but I haven't found the correct coding structure to achieve that functionality.
My goal is to drag two full rotations in both the clockwise and the counterclockwise directions.
I have been able to instruct the wheel to return to the "home" position upon ".Touchup", but the various degrees of controllable rotation I have achieved, while dragging, have been quite ugly...
Has anyone had experience with this type of animation?
I have tried to convert the Heading to a real world angle but failed worst than a failed thing from failed land. (Life would be easier with some rotate Blocks).
Here is my effort to rotate smoothly using the Sprite Block rather than the Canvas Block. If you are left-handed (left fingered) like me, that requires consideration to prevent the image from flipping over the X axis.
The license for that image is actually personal use only (pngfind), so you cannot distribute it in anyway. https://www.pngfind.com/ also have corporate logos/images also shown for personal use when in fact their licence is unlikely to allow any form of use.
... another reason the calculations can confuse is the Canvas origin and axis direction, here is a diagram:
Here is a simple App that demonstrates Canvas coordinates. The code shows a method of setting the Canvas size (which for most purposes should be defined in pixels) to fit Screen size.
On further thought, you could use the Canvas itself as a slider, if you transform the dragged x value from the range (0-Canvas.Width) to the range (-720 to 720) with a little arithmetic.
Dear Chris (@ChrisWard),
for sure autonomous driving level 5 is absolutely without any steering wheel,
Just cross your fngers and hope that the sw does not fail....
Cheers, Ugo.
Try this, the vagaries of rounding, floors and ceiling aren't perfect. Just drag the canvas left and right.
(I used a public domain compass image to keep Chris happy ) rotateSW.aia (24.4 KB)
We are already a bit further along (try my post #8, SteeringWheel.aia), being able to rotate +720 and -720 smoothly.
The difficulty is in translating the Heading Angle into rotated Angle, because (a) the steering wheel center is at the center of the Canvas and (b) App Inventor is reporting point locations in Canvas ordinates. It's relatively easy using vector maths, but App Inventor doesn't support structures.
Why is that difficult, my label shows the angle of rotation? When at 45 the angle from 0 (straight up/down) is 45 degrees. Simply a case of some mathematics once you go past 360 ?