Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by qqignatqq

  1. I tried to change the class to a variable to pass it, but for some reason the first animation doesn't work correctly. I purposely slowed it down to get a better idea of what's going on. The subsequent clicks work fine. Can you tell me what this has to do with and how to fix it? https://codepen.io/accountnujen/pen/dyeqaem
  2. What if I need to animate a list of objects with the class "error", but they just got that class? To clarify. I have a form. It is sent to the server. If the data didn't pass validation, I get a list of input names returned. I need to animate their parents. What do I do with selecting an animated object if it doesn't already exist? I thought I could assign a .error class, issue it to everyone, and then animate it, but if the object doesn't have a class when the page loads, it won't be animated. How to solve this problem? https://codepen.io/accountnujen/pen/yLjxprd
  3. Thank you! I did this: txtdat = ["Success", "Green"]; animate.tweenFromTo("t3", "t5"); I mistakenly thought I should put the data in the gsap method.
  4. Yes, you don't understand me completely. Let's look straight to the second BOX. For example we have at the beginning of the animation the text "Wait...". Action one: the BOX goes down as soon as it disappears from view. Action two: the text on it changes. Action three: it appears again, but with the text "Success". If I do onStart and onComplete, the text changes first, then the BOX goes down and comes back up. The problem is that the user should not see the text change, but with the onStart parameter he sees it, because this is where the animation starts. So I was trying to find a way to pass the parameter not in onStart or onComplete, but specifically in .call(). ... .addLabel("t3") .to(".two-box", 0.25, { y: 30, autoAlpha: 0 }) // hide BOX .call(txt, [param1, param2]) // change text .to(".two-box", 0.25, { y: 0, autoAlpha: 1 }) // show BOX .addLabel("t5"); ... animate.tweenFromTo("t3", "t5", {send param to call(): ["Wait...", "Gray"]);
  5. You must have misunderstood me. At the time of the timeline announcement, I don't yet know exactly what text will be written and what the background will be. That is, I want to define the data at the moment when I call tweenFromTo and pass it to the timeline. If I write .call(txt, [param1, param2]) then js will return me an error because these variables are not declared. I can of course declare them as null, but I don't know how I can pass values for them from tweenFromTo? onStart doesn't fit because I need the old text at the beginning of the segment, onComplete doesn't fit either because the change happens between two animations, not at the end of the animation. And there doesn't seem to be anything else that fits. Or I don't understand what you mean
  6. It's going to get better.) I took a look and decided to go the other way, which you have led me to do. I made one general animation and through tweenFromTo animate the individual parts, but I had an issue with the text. Tell me if there is any way to set variables in timeline and then pass them through tweenFromTo. See what I did: https://codepen.io/accountnujen/pen/bGMKrwQ I have a text replacement happening after the box-one leaves. Is there any way to specify this text in the tweenFromTo itself. That is, I want to get something like this: let animate = gsap .timeline({ paused: true }) .addLabel("t1") .to(".one-box", 0.25, { y: 30, autoAlpha: 0 }) .call(txt, [myparam1, myparam2]) .to(".two-box", 0.25, { y: 0, autoAlpha: 1 }) ........ animate.tweenFromTo("t1", "t3", {[myparam1 = "Wait...", myparam2 = "Gray"]); .... animate.tweenFromTo("t3", "t5", {[myparam1 = "Success!", myparam2 = "Green"]);
  7. I updated my example and added the Animate button. This is what I need to get. I'm just not sure it can all fit in one timeline. For a better understanding, I added a rounding at box-two. That is, box-one disappears and then box-two animates (disappears and reappears with new messages) and then box-one reappears at the end. I tried to do this one via label, but it didn't work. Basically, I can make a separate animation to replace "box-one" with "box-two", then an animation to update "box-two", and at the end an animation to replace "box-two" with "box-one". But I thought I could fit it all into two animations: disappearing and appearing
  8. I have 2 separate animations for hiding and appearing. I don't want them to overlap when they appear, so I need the first block to appear after 0.15 seconds when I return. I prescribed the following code:.reverse(true, 0).delay(0.15); And it works, but only 1 time. The second time it overlaps for some reason. You need to press the buttons: show -> hide ->show -> hide. https://codepen.io/accountnujen/pen/gOzzQVe Help me please
  9. https://disk.yandex.ru/i/QHUxuwHmkLsneg Thanks for your help, but I managed to break both buttons
  10. Hello. I have a function that animates a button to add an item to cart. If the user has not selected the color of the item, the button will be animated. The problem is that there are multiple buttons on the page and I can't use tween.restart() because I can't pass in restart() the button that needs to be restarted. If I use the animation directly in function(elem) {gsap.to.....}, then the animation breaks when I double click (on the second click when the animation hasn't finished yet). Try a quick double click on the "add to cart" button. https://jsfiddle.net/6c3ok48e/4/ If there was a version of the code where I do this: let tween = gsap.timeline() .to(:obj,0.15, {scale:0.5, opacity: 0}).... tween.restart({obj:this}) then maybe this problem wouldn't have happened. I understand that this problem is caused by overwriting the animation. Can you tell me if there is any way to solve this problem?
  11. more than enough. Thank you! You have no idea what kind of face I was sitting with when I saw this strange animation behavior.
  12. Apparently I found a bug. It's really, really weird. So weird that I doubt it's even a bug. I tried to find a mention of this bug on Google, but I found nothing. SO... I actually recorded this bug on video: https://disk.yandex.ru/i/auE3Yt8DiGK57g but here is the text version: If you specify a font size of 2.8vw (in other sizes it happens too, but with a different probability) and a screen width of 600px, the 'y:0' animation will be executed as 'transform: translate(0%, -50%)' Here's the code https://jsfiddle.net/fLno0mq3/ How can this be?
  13. Hello. On low screen resolutions I will have a completely different header, so I don't need the scrollTrigger animation. I understand that I have to write conditions in "onRefresh", but I don't understand what exactly I have to write there. If I make disable(), then I can't make enable() because there's nowhere to do it. Here is code: https://jsfiddle.net/3dm1xnp5/
  14. Cool. Last question: Tell me, how much better is the first option than the second? // first let tl = gsap.timeline({paused: true, repeat: 1,yoyo: true,repeatDelay: 1}) .to(msg, 0.25, {autoAlpha: 1,y: -40,ease: Expo.inOut}, "<"); function showMsg(message) { msg.innerText = message; tl.restart(); } //second function showMsg(message) { msg.innerText = message; gsap.timeline({repeat: 1,yoyo: true,repeatDelay: 1}) .to(msg, 0.25, {autoAlpha: 1,y: -40,ease: Expo.inOut}, "<"); } Or do they put the same load on the system? The first one is declared and restarted, and the second animation is prescribed immediately in the function and repeated.
  15. ok. If I want to make a universal animation and animate different objects with it, how do I do that? function animate(elem) { gsap.timeline({ease: "power1.inOut",repeat: 1,yoyo: true,repeatDelay: 3}) .to(elem, { opacity: 0, scale: 0.5, transformOrigin: "center", duration: 0.3 }) .set(elem, { text: { value: "ДОБАВЛЕНО", delimeter: " " } }) .to(elem, { opacity: 1, scale: 1, transformOrigin: "center", duration: 0.3 }, "<") } I just assumed that it would be convenient to do it this way: declare a "tween" and pass in Restart() (or another action) the object to be animated. I mean something like this: const tl = gsap.timeline({ease: "power1.inOut",paused: true,repeat: 1,yoyo: true,repeatDelay: 3}) .to(?, { opacity: 0, scale: 0.5, transformOrigin: "center", duration: 0.3 }) .set(?, { text: { value: "ДОБАВЛЕНО", delimeter: " " } }) .to(?, { opacity: 1, scale: 1, transformOrigin: "center", duration: 0.3 }); tl.restart({object: ".target"}); p.s. And thank you so much for the solution. I had completely forgotten about the ".set".
  16. Hello. I want to animate a button: - old text disappears - new text appears - reverse animation. I used textPlugin, but I don't quite understand how to change sentences rather than individual words. At the moment it turns out that the old word hasn't disappeared yet, but the new one has already appeared and there is an overlap. I was already thinking about abandoning textPlugin and using onComplete: () => {document.querySelector(".btn span").innerText = "newtext"}, but then I can't do a reverse animation because the previous text is not restored. view: https://jsfiddle.net/8nz6sw53/1/ And another small question: gsap.to(".btn", {onComplete: (?elem?) => {elem.innerText = "new text"} Is there any way to pass a ".btn" object to a function to refer to it via elem?
  17. Sorry for the silly question, but why is onUpdate needed? Won't it make things worse? At the moment I see that everything works, but won't something break in the future?
  18. Hello. I know I'm bringing up a closed topic, however recently akapowl posted in the thread https://greensock.com/forums/topic/17300-smooth-page-scroll/?do=findComment&comment=138046&_backrid=70811 and I got an alert since I'm subscribed to the thread. The situation is this: I needed to make a fixed header that reduces its height when scrolling. But a problem appeared: if I change the width of the window (the height does not change), then for some reason the animation is triggered. Here is an example: https://jsfiddle.net/trajwbzh/ Here's a video: https://disk.yandex.ru/i/1B6YRGyO0eIg6A I need your help
  19. Oh, hello. I opened the source code for gsap, but I never figured out how the opacity animation works. gsap.to("object", 1 , {opacity:0, ease:Expo.easeOut}); What was this code supposed to look like in native JavaScript? This code will just make the object transparent, but it will not make it smooth: document.querySelector("object").style.opacity = 0; I assumed it might be "setInterval": however, I didn't find any lines with "clearInterval" in gsap code Here's what I was able to do... https://jsfiddle.net/eymw4o6j/2/ I couldn't figure out how to put an operator in a variable, that is: if the current transparency value is less than the required one, there will be an operation: objOp = objOp + nTime; and if it's more, then..: objOp = objOp - nTime; the only thing that came to my mind was to make "if" and make 2 options setInterval for each option... I didn't understand at all how ease works... So, does it change the step? How did you guys make gsap? It's unrealistically cool and beyond my comprehension. p.s. considering what I wrote, it becomes fantastic for me to have this command: gsap.to("object", 1, {y:10, ease:Expo.easeOut});
  20. Hello again. Can you tell us how to implement the same animation in pure JavaScript? I'm trying to repeat the action, but it doesn't work. Help me, please. The problem is the same as it was with gsap - the animation does not repeat itself if you click quickly several times. var playShowMsg; function myShow() { clearTimeout(playShowMsg); document.querySelector(".transition").classList.remove("showmsg") playShowMsg = setTimeout(function(){document.querySelector(".transition").classList.add("showmsg");}, 0); playShowMsg = setTimeout(function(){document.querySelector(".transition").classList.remove("showmsg")}, 2000); } https://jsfiddle.net/kf06dc5w/
  21. 6%? What? Wait, you have 6% where it shows? In Task Manager? Or the Perfomance monitor in your browser? If you have 6%, I would venture to assume that you just have intel i9-9900KS. Yeah, I tried to use that. It didn't help. I tried, but it didn't help, but thank you for that, because I didn't know about xyPercent before. I'm not allowed outside. I have 20 of those blocks on my website. Only if you prescribe a separate animation for each block, but I don't think it'll help much. How can "this" load the CPU so much?
  22. Hello. I am animating, but I am observing a high load on the CPU. The essence of animation is as follows: when you hover over a block, the main image should approach and when you move the mouse on this block, the image should also move. video: https://yadi.sk/i/XfepvkILc7_0oA https://jsfiddle.net/j5bcuar3/5/ 1. Why is the CPU loaded? After all, as I understood, at animation the CPU should not be loaded. 2. Hint, is it possible somehow to optimize this animation to reduce the load a little bit and increase the smoothness?
  23. Hello. I really like the smooth scrolling that OSUblake did. But I ran into a problem: my "position: sticky" doesn't work. I understand that it has to do with the fact that the Smooth Scroll animation itself works thanks to a fixed block. And the scrolling itself is an imitation. Quote: Can you tell me if there's any way to solve this problem? https://jsfiddle.net/9amfw36d/2/
  24. I haven't studied threejs, but I've heard of him. The problem is to implement this: https://threejs.org/examples/?q=wav#webgl_points_waves you have to drag all threejs with they modules, which doesn't look very productive. All I need is this point animation, not the whole threejs...
  25. Hello. I found this kind of animation on the Internet. I have a feeling it's hanging a little. Can you tell me if it's possible to optimize the animation with GSAP or I don't quite understand the purpose of GSAP? https://codepen.io/H2xDev/pen/bJNNEX