Object rotation

  • #40, by tristan-kangWednesday, 23. September 2015, 02:08 9 years ago

    Was meant more as a tip / note about alternative possibilities of rotation in VS.

    My point about not needing many frames for actual rotation for a flat object such as a gear, windmill or propeller is that you only need to animate the turn between one gear tooth or propeller blade movement, then you just loop back to the first frame. The only way this is not possible is if the image contains unique texture or things draped on top of or attached to it. Maybe you have a windmill & it has flora growing on parts of it.


    Objects["Propellers1_bedroom"]:to(1500, {Rotation = math.rad(360)}, easeLinearInOut, true, false)
    Objects["Propellers2_bedroom"]:to(1500, {Rotation = math.rad(360)}, easeLinearInOut, true, false)
    Objects["Gears1_bedroom"]:to(3000, {Rotation = math.rad(360)}, easeLinearInOut, true, false)
    Objects["Gears2_bedroom"]:to(3000, {Rotation = math.rad(360)}, easeLinearInOut, true, false)
    Objects["Gears3_bedroom"]:to(3000, {Rotation = math.rad(360)}, easeLinearInOut, true, false)
    Objects["Gears4_bedroom"]:to(3000, {Rotation = math.rad(360)}, easeLinearInOut, true, false)
    Objects["Gears5_bedroom"]:to(1500, {Rotation = math.rad(360)}, easeLinearInOut, true, false)
    Objects["Gears6_bedroom"]:to(1500, {Rotation = math.rad(360)}, easeLinearInOut, true, false)
    


    There are current objects I've made. Before I use this script, I made around 10 frames for one object (image) before, like I located every image 36 degree. Of course I didn't need to put final image because final image is first image. Now after...

    I don't know what you saying, it just works too perfectly from my view and I can save tons of resources to make a game smaller. And the image locates full frame (this is important) and it is too smooth no matter how image is complicated. I can show you the video how I made it anyway if you request.

    Seems like there is hidden bug that I don't know... you're scaring me. lol

    I can't turn back what I have done to around 40 frames for images...

    Great Poster

    267 Posts


  • #41, by afrlmeWednesday, 23. September 2015, 02:59 9 years ago
    hehe don't worry about it.

    What I was talking about was this...
    http://wiki.visionaire-tracker.net/images/ftp/windmill_(symmetrical_w_6_frames).gif
    Let's just pretend each of the blades are exactly the same. If we were animating manually then we would only have to animate the distance from starting degree to the distance it takes to get one blade to the same position of another blade. Then we just loop those few frames.

    Imperator

    7278 Posts

  • #42, by tristan-kangWednesday, 23. September 2015, 03:09 9 years ago
    hehe don't worry about it.

    What I was talking about was this...
    http://wiki.visionaire-tracker.net/images/ftp/windmill_(symmetrical_w_6_frames).gif
    Let's just pretend each of the blades are exactly the same. If we were animating manually then we would only have to animate the distance from starting degree to the distance it takes to get one blade to the same position of another blade. Then we just loop those few frames.


    But still it's better having one image and locate it rather than having 6 frames = 6 images (I can see 6 frames in your example). Besides, if I use the script, then it's always 60 FPS.

    I'll use the script for my entire game developing. lol

    Great Poster

    267 Posts

  • #43, by afrlmeWednesday, 23. September 2015, 05:08 9 years ago
    Yes, it's better to use the new rotation fields & tween functions when possible. wink

    Imperator

    7278 Posts

  • #44, by LebosteinWednesday, 23. September 2015, 10:21 9 years ago
    I use this functions for an infinity rotation of a huge water wheel (1160 x 1160 px). I have no problems with that. I see more advantages:
    1. You have to load only one frame in the memory
    2. You can use an unsymmetric image for rotation

    Before I found that I used an 5° symmetric wheel (to minimize the frames) with 10 frames (symmetric rotation = 0.5° per frame). No I can use a 45° symmetric wheel (like the original water wheels) and 1 frame:

    Key Killer

    621 Posts

  • #45, by PaupasiaThursday, 24. September 2015, 16:12 9 years ago
    Solved. Unfortunately also the object.rotation=1.5 works only once, so I've changed the puzzle to make my life more easy (no random, but four working keys) grin
    Looking for a solution in internet, I've found this script made for CSS, I'm really interested in this workflow because I can set a value or condition only for one class(rotation) and link the object to his own script (with cycle puzzle, even if I create more scripts with different conditions, only the first works due to the tables. Well maybe I've done something wrong).
    Maybe this script could be translated in Lua or maybe what I'm saying is really stupid, but who knows?
    The script is made for various browser, but I'll put only the Firefox version:

    Class definitions

    .rotate0 {
    transform: rotate(0deg); /* standard */
    transform: rotate(0deg); /* Firefox */
    .rotate90 {
    transform: rotate(90deg);
    .rotate180 {
    transform: rotate(180deg);
    .rotate270 {
    transform: rotate(270deg);

    Rotation with Javascript (JQuery) rotate 90 degrees every mouse click

    $(document).ready( function() {
    rotation_img = 0
    $('#my-image').click( function() {
    rotation_img += 90
    $(this).attr('class', 'rotate' + rotation_img % 360 )
    })
    })

    and here the link to the original page (sorry is in Italian)
    http://www.simogrima.com/css/ruotare-immagini-attraverso-i-c...


    Forum Fan

    165 Posts

  • #46, by afrlmeThursday, 24. September 2015, 16:48 9 years ago
    Yeah, as I mentioned before I already tried incrementing & decrementing the current rotation values, but didn't have much success with it.

    The table method was simple enough, write the target degrees & it checks current degree then looks for the next or previous degree in the table.

    Imperator

    7278 Posts

  • #47, by PaupasiaFriday, 25. September 2015, 12:59 9 years ago
    Ahah! I agree, they are equal in a different way. grin
    So my last question...how can I give you a proper credit in my game?
    Only the name AFRLme, a site or something else?
    You surely deserve all the special thanks!

    Forum Fan

    165 Posts

  • #48, by afrlmeFriday, 25. September 2015, 13:21 9 years ago
    Lee Clarke or Lee Clarke [AFRLme] is fine. Cheers. wink

    P.S: I'm sure I'll probably end up providing more support somewhere down the line - usually seems to be the case.

    Imperator

    7278 Posts

  • #49, by PaupasiaFriday, 25. September 2015, 15:07 9 years ago
    Thank you so much Lee and have a nice day!
    P.S. I agree, you are a treasure for this forum grin

    Forum Fan

    165 Posts