Camera move with anticipation and reaction [Solved]

  • #1, by TinTinTuesday, 27. February 2018, 08:34 2 years ago
    Hi

    How can I modify camera  motion with anticipation and reaction?
    For ex: We want move camera from left to right: In first, move a little to invert direction (anticipation) and move to right and pass from target (reaction)  and finally back to target.

    Please see image:

    Forum Fan

    193 Posts


  • #2, by afrlmeTuesday, 27. February 2018, 11:26 2 years ago
    I'm not 100% sure on what you are asking for here. In layman's terms you are wanting to first move the camera a fraction to the left of the characters position & then pan all the way to the right of the scene before finally moving back to the characters position?

    execute a script >
    game.ScrollCenterCharacter = false  -- stop camera from centering on the character

    game:to(250, {ScrollPosition = {x = (game.CurrentCharacter.Position.x - 50), y = game.ScrollPosition.y}}, easeQuintIn)
    1
    2
    3

    pause for 250ms
    execute a script >
    game:to(3000, {ScrollPosition = {x = 1920, y = game.ScrollPosition.y}}, easeQuintOut, false, true)
    1


    No idea if it will work.

    Imperator

    6816 Posts

  • #3, by sebastianTuesday, 27. February 2018, 11:35 2 years ago
    sounds like a good job for an easing function (easeBackInOut)  that lets the camera move like that

    game:to(3000, { ScrollPosition = {x = 1500, y = 0} }, easeBackInOut)

    moves the camera to x=1500 in 3000ms

    Thread Captain

    2336 Posts

  • #4, by afrlmeTuesday, 27. February 2018, 11:45 2 years ago
    sounds like a good job for an easing function (easeBackInOut)  that lets the camera move like that

    game:to(3000, { ScrollPosition = {x = 1500, y = 0} }, easeBackInOut)

    moves the camera to x=1500 in 3000ms
    You're right mate, but you forgot to add the true value after easing to make it reverse afterwards.

    delay >  parameters > easing > loop > reverse

    I also completely forgot that there was an easing to make it move away from target first. He still needs to clear centering from the character to be able to scroll the camera I think?

    Imperator

    6816 Posts

  • #5, by sebastianTuesday, 27. February 2018, 11:57 2 years ago
    as far as i understood it should go back to the target, not to the beginning. I interpreted that "back to the target" into the easing function which does exactly what he described

    Thread Captain

    2336 Posts

  • #6, by TinTinTuesday, 27. February 2018, 13:49 2 years ago
    Thanks so much guys.
    @AFRLme
    I'm 2D animator and I want some cartooning camera motion. please see here for more info:
    https://www.google.com/search?source=hp&ei=hFKVWr6REaWm_QaVz...

    Also your codes doesn't work perfect for me. It move fast and seems there is not anticipation and reaction.

    @Sebastian
    I works fine with anticipation but without reaction. How can I fix it with reaction too?

    Forum Fan

    193 Posts

  • #7, by sebastianTuesday, 27. February 2018, 13:56 2 years ago
    @Sebastian
    I works fine with anticipation but without reaction. How can I fix it with reaction too?
    Have a look here: http://easings.net

    These are the available methods you can use. Note that the names differ in VS.
    easeInOutBack for CSS is easeBackInOut in VS

    Thread Captain

    2336 Posts

  • #8, by TinTinTuesday, 27. February 2018, 14:15 2 years ago
    Great!!!. Works perfect smile
    Thanks so much


    Forum Fan

    193 Posts

  • #9, by afrlmeTuesday, 27. February 2018, 15:01 2 years ago
    Interesting & yeah sorry, like I said... I didn't really understand what you were asking for. My bad!

    Imperator

    6816 Posts

  • #10, by TinTinTuesday, 27. February 2018, 15:06 2 years ago
    Interesting & yeah sorry, like I said... I didn't really understand what you were asking for. My bad!
    I'm really sorry for my bad English

    Forum Fan

    193 Posts

  • #11, by afrlmeTuesday, 27. February 2018, 17:34 2 years ago
    Wasn't that. I just didn't understand what you were asking for & I had no idea what the little number image thing you created was for.

    Imperator

    6816 Posts

Write post