We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Set scrollY in puzzles

Home Forums Programming Set scrollY in puzzles

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #61403
    tylarthefarmer
    Participant

    Hello!

    I followed Soft8Soft’s tutorial for creating a scrolling animation linked here. The scene is also available via the asset store, linked here.

    I am trying to figure out how to jump to a section of the scroll animation in response to some event, such as a click on an element. Normally I would just set the variable that determines the animation frame, but the difficult part is that the animation frame is dependent upon the “current_scroll” variable, which is grabbed from the “scrollY” property. Since the “scrollY” property is read-only, I am not sure how I can jump to a section of the animation that won’t result in some weird interactions with continued scrolling. Setting the “current_scroll” value directly works until you attempt to scroll again, then it just jumps back to where it was previously since the “scrollY” property was not updated.

    I have tried manipulating the “scrollTop” property and setting anchor points in the HTML, but those methods don’t alter the amount scrolled, which determines the animation frame. Any help would be appreciated!!

    #61404
    xeon
    Customer

    Not sure if this will work on or not but worth a try.

    You may want to put your scroll function in an if then statement.
    If the user is in scroll mode….use the scroll function. If the user jumps…exit scroll mode and jump and then reset the varialbe to go back to scroll mode. Might work…not sure. But watching this thread for other solutions.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #61458
    tylarthefarmer
    Participant

    Not sure if this will work on or not but worth a try.

    You may want to put your scroll function in an if then statement.
    If the user is in scroll mode….use the scroll function. If the user jumps…exit scroll mode and jump and then reset the varialbe to go back to scroll mode. Might work…not sure. But watching this thread for other solutions.

    Thanks for the suggestion! The problem I see with this implementation is that once we switch back to scroll mode, it will jump back to where it was before it jumped. I don’t see a way to update the scrollY variable to act as if it was scrolled to the portion that was jumped to.

    #61555
    xeon
    Customer

    As soon as you make the jump you are storing that Y varialble. When you jump back you make sure the scroll is set to that stored Y variable.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.