How to slide a button and make a hammer swing?
I have a large hammer and I want to make it swing and smack down then come back to the upright position. Then image starts at X 38 Y 147 Rotation 60. This is the upright position. To make the image appear to swing like a hammer I have to rotate the image to 0.0 and Move to X 59 Y 127. I have a circular button that users will drag from right to left. As the image is dragged I would like to manipulate the above numbers. Then as the image comes back obviously reverse it. I only want my button to move 140 pixels and its 70 pixels wide and starts at X 175. I've created 3 real attributes one for each of the variables and constrained them to the correlating attributes of the image. Now I just need to increase the X and decrease the Y and Rotation of these attributes as the button is dragged left to swing the hammer. From there I can reverse it and make it go back.
Best Answers
-
Socks London, UK.Posts: 12,822
@wayback_gamer said:
I have a large hammer and I want to make it swing and smack down then come back to the upright position. Then image starts at X 38 Y 147 Rotation 60. This is the upright position. To make the image appear to swing like a hammer I have to rotate the image to 0.0 and Move to X 59 Y 127. I have a circular button that users will drag from right to left. As the image is dragged I would like to manipulate the above numbers. Then as the image comes back obviously reverse it. I only want my button to move 140 pixels and its 70 pixels wide and starts at X 175. I've created 3 real attributes one for each of the variables and constrained them to the correlating attributes of the image. Now I just need to increase the X and decrease the Y and Rotation of these attributes as the button is dragged left to swing the hammer. From there I can reverse it and make it go back.Didn't really understand most of that !
You basically want a hammer type action controlled by a slider ? I'll make you a quick demo . . . .
-
Socks London, UK.Posts: 12,822
Here you go, drag the red box left and right to hammer stuff, the values are probably nothing like you want or need but it should give you a basic idea and I'm sure you can adjust stuff to suit your own needs.
-
Socks London, UK.Posts: 12,822
Here's a kind of spring loaded one, drag the red box to the left then release . . .
Answers
Thank you "Socks".
Feel free to use the hammer noise if you want, but the hammer image I just grabbed off Google.