Home › Forums › Programming › Set scrollY in puzzles
Tagged: Animations, puzzles, scrolling
- This topic has 3 replies, 2 voices, and was last updated 1 year, 8 months ago by xeon.
-
AuthorPosts
-
2023-03-25 at 4:52 am #61403tylarthefarmerParticipant
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!!
2023-03-25 at 5:32 am #61404xeonCustomerNot 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.com2023-03-28 at 2:39 am #61458tylarthefarmerParticipantNot 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.
2023-03-30 at 3:44 pm #61555xeonCustomerAs 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 -
AuthorPosts
- You must be logged in to reply to this topic.