Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Helper Function] Rotate a Token Around One of Nine Pivot Points

1394962479

Edited 1394962907
Konrad J.
Pro
API Scripter
I'm fairly happy with how it turned out. Works great. I hope someone will take it and create some great scripts with it? When I get some time I'll be working on Car Wars or Man O War I think. Here are the comments on how to use the function, its easy. // Helper function to rotate a graphic token around any one of nine pivot points // // copyright pug games 2014 // please feel free to use this function, change it, add to it in any way you feel // functions created by Roll20 user Konrad J. // // to use these helper functions in your own script you need all three, trueRotation, getPoints, and processRotation. // the only function you need to call in your own script is processRotation. You need to pass it // pivotPoint, degToRotate, and the id of a graphic token you want to rotate // processRotation returns true if it could find the token and false if it could not // // pivotPoint is a string, one of nine points on a token // topLeft, topMid, topRight, midLeft, midMid (centre), midRight, botLeft, botMid, botRight // tl, tm, tr, ml, mm, mr, bl, bm, br // // tl--tm--tr // | | // ml--mm--mr // | | // bl--bm--br // // degToRotate is a number, the degrees to rotate can be 0 to 360 to rotate clockwise and -0 to -360 to rotate counterclockwise // <a href="https://gist.github.com/morval/9580719" rel="nofollow">https://gist.github.com/morval/9580719</a> PS: How do you make it so the code shows in the post? I've tried both Github and a Github Gist, but my don't seem to show up?
1394963095
Konrad J.
Pro
API Scripter
I'll post an example test script Sunday so anyone that wants to try it can. Also might make a quick video of it in action if I find some time.
1394989983
Konrad J.
Pro
API Scripter
OK, here is a video demo of the rotate function and a test script you can use to test it for yourself. <a href="http://www.youtube.com/watch?v=j7el8vfr6NU" rel="nofollow">http://www.youtube.com/watch?v=j7el8vfr6NU</a> <a href="https://github.com/morval/Rotate-Function/blob/mas" rel="nofollow">https://github.com/morval/Rotate-Function/blob/mas</a>...