Jump to content
Search Community

102

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by 102

  1. I am doing exact same thing with this post but updating position along the path with motionPath is just making position (0,0) for each frame. What is causing this?

    Codepen: 

    const path2 = [{x:ball.x, y:ball.y}, {x: cp2x, y: 40}, {x: target.x-ball.x,y:target.y-ball.y}]
                    console.log(ball.x, ball.y)
                    gsap.to(ball, {
                        duration: 1,
                        motionPath:{
                            path: path2,
                            type: 'cubic'
                        },
                        onUpdate: () => {
                            console.log(ball.x, ball.y)
                        },
                        onComplete: () => {
                            console.log("complete")
                            if (ballInfo.target < this.pins.children.length) {
                                ballInfo.target++;
                                this.moveBall(ball, index);
                            } else {
                                // End of animation logic
                            }
                        }
                    });

    image.png.e7c15683a8feb1fab6e881796e892022.png

    See the Pen dyLQorr?editors=0011 by alparslanahmed (@alparslanahmed) on CodePen

×
×
  • Create New...