Jump to content

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


  • Content Count

  • Joined

  • Last visited

Community Reputation

35 Newbie

About Nekiy2

  • Rank
    Advanced Member
  • Birthday 11/22/1985

Profile Information

  • Gender
  • Location

Recent Profile Visitors

801 profile views
  1. Hi! You can use Threejs animation, you can use Threejs with gsap animation, you can use Pixijs with gsap animation Its your choise. With gsap you can animate almost any value or property gsap is free (only if you want to use club plugins you need to pay) you can use with CDN or download zip localy, NPM... as you wish https://greensock.com/docs/v3/Installation BUT if you use in games, for example - you need Business licensing Check this page
  2. You ask about js/jquery but this is GSAP forum, please create simple Codepen demo, what did you try to do with gsap? what issues did you get? Plese read first:
  3. let isPassed = false // global variable for detct is instanse is passed const $el = document.getElementById('drag-me'); let dragInstance = null; dragInstance = Draggable.create($el, { type: 'x,y', zIndexBoost: false, onDragStart: ()=> isPasses ? document.body.style.backgroundColor = 'pink': false, onDragEnd: ()=> isPassed ? document.body.style.backgroundColor = '' : false })[0]; What about check isPassed and if it passed - do something Or you can create public method and check it yourClass.isPassed() // return true/false
  4. Can you explain why do you need create listener inside listener callback (you create two listeners for one event) By the way, Draggable already have listener onDrag, onMove ... you dont need create it again. I can't imagine why do you need to create listener every time on Drag start.
  5. Hi! You dont need create eventlisteners You can use just like: const $el = document.getElementById('drag-me'); let dragInstance = null; dragInstance = Draggable.create($el, { type: 'x,y', zIndexBoost: false, onDragStart: ()=> document.body.style.backgroundColor = 'pink', onDragEnd: ()=>document.body.style.backgroundColor = '' })[0];
  6. Yes. But not sure that i need it 😆 if i can clear and recreate timeline when i need it I want more learn gsap. I see on forum that someone use like: let tl = gsap.timeline() function addtl(){ return gsap.to('element', {x:100}) } tl.add(addtl()) and want to find more examples like this, and does someone use.remove() with this type of create timelines. Its mostly for learn gsap
  7. I talk about example (if you have) where you use this methods something like: let tl = gsap.timeline() tl.add(tl2).add(tl3) // after some code tl.remove(tl2) // or something tl.remove(tl2).add(tl4) Does it usefull? I find answer on my main question: but interesting examples about nested timelines and add and remove tweens in one timeline
  8. Thank you! @akapowl, nice example, thank you @ZachSaucier, thank you! does it exist aditioanal example for .add() .remove() methods on codepen?
  9. Something like https://codepen.io/Nekiy2/pen/bGpjVXR but its not working (i cant apply duration) and i see some lags and more massive then post with clear()
  10. Thank you! Question is timeline have method.remove([tween,timeline,subtimeline,...]) and .add(child, position) if i find how to remove tween from timeline and add to correct position other one i dont need clear() all timeline just replace and i take less code and more functionality
  11. Hi!, can you provide minimal demo on codepan? Ypu place code but its not readable I reformat your code via Prettier, but what result do you have? Better create codepen minimal demo const Sticky = () => { const sectionOffset = `${sectionRef.current.offsetTop}`; if (!Killed) { // ScrollTrigger.saveStyles(stickyRef.current) // ScrollTrigger.config({ limitCallbacks: true }) ScrollTrigger.matchMedia({ "(max-width: 480x)": () => { ScrollTrigger.create({ trigger: stickyRef.current, pin: true, start: `top-=${sectionOffset}
  12. Or better clear timeline and create new one? like Jack write? I try to create with tl.totalTime(0).clear() but its to massive (check codepen) https://codepen.io/Nekiy2/pen/MWyBwGy?editors=0010
  13. Hi! I try to change animation with (window.matchMedia()).matches How can i get tween from timeline and replace (or edit) it? I read about .remove() method, but how can i add on removed place other tween and how can i add label to tween. for example: tl .addLabel('start') .to('.box-1', {x:100}, "start") // <--- how to change this or how to .remove() this and place other tween on this place .to('.box-2', {x:100}, "start")
  14. Thank you! Thats what i need!! I update demo https://codepen.io/-greg-/pen/VwapPPw
  15. Why i try to create something like generator: i have about 10 elements whitch has almost same animation, first i create functions: let tl = gsap.timeline({defaults: {duration: 0.2}}) let el1 let el2 let el3 ... function fun1(){ if(el1){ // if element exist let tl = gsap.timeline() tl.fromTo(el1, {x: "-=10", autoAlpha: 0}, {x: "0", autoAlpha: 1}) return tl } } function fun2(){ if(el2){// if element exist let tl = gsap.timeline() tl.fromTo(el2, {y: "-=10", autoAlpha: 0}, {y: "0", autoAlpha: 1}) return tl } } function fun3(){ if(el3){// if element exist let tl =