Jump to content


  • Posts

  • Joined

  • Last visited

willdzoan31's Achievements

  1. you just saved me from hours of misery Thanks Jack!
  2. I've having trouble understand why this animation keeps producing strange behavior (The orange panel kinda disappear when it start animating). All of the code I copied from gsap codepen and tried it in a React app. Can anybody help me with this? https://codesandbox.io/s/competent-snow-36uyp5?file=/src/App.js
  3. So in a React application like this for example: const [state, setState] = useState(0) the state can only be changed/updated via the setState(value). And in your example, you're changing the value directly, which won't work in a React application I believe. So I'm just curious, is there anyway for me to call the setState(value) during that?
  4. Hmm that's interesting! So can I change react state with Tween like you mentioned above?
  5. Thank you @GreenSock, I didn't know you can increase the z value like that. Will try that one out! And for the second part that you talked about, I've setup my container to have 300vh and my app is 100vh (#app is inside the #appContainer), so it animates the way I expected
  6. I have a piece of code like this: tl.current = gsap.timeline({ scrollTrigger: { trigger: "#appContainer", start: "top top", end: "bottom bottom", pin: "#app", srub: 1, onUpdate: (e) => { if (e.direction === 1) { for (let index in elements.children) { let mesh = elements.children[index] let position = mesh.position position.z += 0.05 * e.progress } } else { for (let index in elements.children) { let mesh = elements.children[index] let position = mesh.position position.z -= 0.05 * e.progress } } } } }) Basically what I'm trying to do is animate an object inside a threejs scene during scrolling, 2 ifs to make that object return to the normal position when scroll up. But I notice that whenever I console.log the e.progress value, it's not the same (might be because of debounce or throttle?), especially when I scroll fast. Can you guys help me to see if there's a better way to do it? Essentially I want that value of position.z to be the same as starting when the user scroll up.
  7. Oh nvm, I got it. Thank you @Cassie, you're a hero!
  8. So in my case, I have the div on the right (it's the content for each of the div on the left), it's all have style of display: none right now. Whenever I add the "active" class to the left, it will also add the "active" on the right (which will remove the display: none for that div)
  9. Thank you so much for the demo. Last question, can I toggle multiple class at the same time? Like have another sections array and add the class to it?
  10. Hey @Cassie, I've able to do what I want using onUpdate on the timeline (not the best way I know ), but haven't figured out a way to progress the timeline when click on the element on the left. Seems like the func tl.progress(...) doesn't do anything for me.
  11. Hi @Cassie, thank you for getting back to me. I will dive deeper into the docs then
  12. I've setup my codesandbox like this: https://codesandbox.io/s/adoring-panna-c6liiw?file=/src/styles.css:36977-36980 I want to add an animation that when you scroll down, it will pin the table to the center, and it will add/remove class to the left column accordingly to give a feel like you switching tab while scrolling. So for my setup, I want it to add class "element-active" to the div with the class ".element-tab-title". Can anyone point me to the right direction? I'm literally don't have any ideas how to achieve this effect. Note: The id for all the div on the left would be one, two, three, four, five. These are the elements that I want to add/remove class "element-active"
  13. What I want to achieve is like this website: https://dxc.com/us/en Basically when you scroll to that section, the one on the left will be fixed, while you keep scrolling, it will scroll the section on the right. I've tried to pin the left section, but somehow it always produce strange behavior Codesandbox: https://codesandbox.io/s/busy-sky-6pjo3o?file=/src/App.js
  14. Hi @PointC, thank you so much for the advice. You can find my demo in this codesandbox: https://codesandbox.io/s/unruffled-bush-zvjo70?file=/pages/index.js You might notice when you first scroll down, the words get smaller a bit before scaling up.
  15. I know this might me a dumb question, but I have 2 animation. - First one animate a fade-in scale-up animation, which I have it like this: - The second one, I attach it to a scrollTrigger time line, which will scale the element up when scroll animation.current = gsap.timeline({ scrollTrigger: { trigger: "#image-box", start: "top center", end: "+=300", scrub: 1, markers: true } }) animation.current.to( "#image-box", { scale: 4, duration: 1, ease: "Sine.easeInOut" } ) My guess what went wrong is, when it's running the second animation, it's getting the first scale value from the first animation (0.2) as a starting value, which is why when the second animation experiences a little "hiccup" (it's scale down to 0.2 immediately, then start scaling up to 4). I'm still making a demo on codesandbox but just gonna put this here incase it's an easy fix.