Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

Aitor

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by Aitor

  1. There is something I don't understand. let openMenu; // <------------------------- in the global scope menu.open = () => { if (!isOpen) { // <-------------------- If this menu is closed isOpen = true; // <------------------ set it to open openMenu && openMenu.close(); // <--- I don't understand this line. The last part closes // the open menu but what does "openMenu &&" do? openMenu = menu; // <---------------- Store this menu in the openMenu variable } }
  2. Of course it helps. I agree that it is much better approach: better functionallity and more readable. After seeing this solution it seem obvious. I learned some interesting things like overwrite property. And some javascript basics: I thought this way of declaring the isOpen variable would put it in the global scope, but the variable belongs to the scope of each menu, just like box and items. Thank you much.
  3. Starting from this work I want to achieve an accordion with different ease when open and close. So, It relies in progress() state instead reversed() state and has two tweens (open and close) instead one tween (reversed or not). It works, more or less. The main problem is that I can't close all the .accordion-groups as in the original: Original codepen (line 16): animations.forEach(animation => animation.reverse()); My codepen (line 24): animationsClose.forEach(animationClose => animationClose.play()); I can't see why.
  4. Very well seen. That was the problem. Thank you.
  5. Ok. Thank you very much for your attention. In order to clarify the issue, I did a simplified codepen and a screencast from two brosers and describe more accurately the problem: Firefox render from negative to positive. These are screen recordings from Chrome and Firefox (macOS 11.4). As you can see, the recording from Chrome works perfectly, showing the smooth concatenation of iterations. On the contrary, Firefox begins each iteration, surprisingly, in negative, taking a walk in each iteration from negative to positive. https://codepen.io/aitormendez/pen/GRmNMzM
  6. Sure it helps! thank you. It solves the main question. For the other problem (it works in chrome but not in Firefox), maybe in another thread? I mean, the loop restart from scratch in firefox (macOS) each iteration repeating the same sequence with same colors, instead chaining smoothly the iterations with different colors. I'm sorry if I haven't been clear. I can make a screencast if needed.
  7. Trying to animate a radial gradient background in a loop. The background has three radial gradients: background: radial-gradient(100% 102.5% at 16% 80%, rgba(0, 133, 255, 0.76) 0%, rgba(255, 255, 255, 0) 100%), radial-gradient(100% 102% at 80% 20%, rgba(0, 133, 255, 0.76) 0%, rgba(255, 255, 255, 0) 100%), radial-gradient(100% 100% at 20% 80%, rgba(255, 245, 0, 0.76) 0%, rgba(255, 255, 255, 0) 100%); It works but the first iteration doesn't take the initial values set it in CSS file. It seems to animate from 0 values. Any help appreciated. Thanks. EDIT: embedded codepen doesn't work well in firefox but it works in Chrome
  8. Trying to change background color to different color for each loop iteration using onRepeat callback. It doesn't work. How can I acheve this? Thanks. let R, G, B, dur; const setVars = () => { R = Math.floor((Math.random() * 255)), G = Math.floor((Math.random() * 255)), B = Math.floor((Math.random() * 255)), dur = Math.floor((Math.random() * 4)); } const getColor = () => { setVars(); return `rgb(${R}, ${G}, ${B})`; }; setVars(); TweenMax.to(".colores", { duration: dur, backgroundColor: getColor, repeat: -1, onRepeat: getColor(), });
  9. Understood! Thank you, @Carl
  10. Yes! Thank you very much for the quick and accurate answer.
  11. Trying to test onStart and onComplete callbacks: this code write 'play' and 'finish' in the console at the same time (immediately start time). What is wrong here? How can I fire a function when timeline ends? Thanks! function bannerDown(){ let tl = new TimelineMax({ onStart: console.log('play'), onComplete: console.log('finish'), }); tl .to('.content', .5, { paddingTop: bannerHeight, ease: Power4.easeOut, }, 0) .to('.banner', .5, { y: 0, height: 'auto', ease: Power4.easeOut, }, 0); return tl; }
×