ForgeableSum Posted March 1, 2015 Share Posted March 1, 2015 Suppose I am tweening a sprite along a quadratic bezier curve like so: var controlX = attacker.x;var controlY = attacker.y - 100; var time = 5000; var demoTween = game.add.tween(projectile).to({x : [attacker.x, controlX, moveX],y : [attacker.y, controlY, moveY],}, time, Phaser.Easing.Quadratic.Out, true) .interpolation(function(v, k) {return Phaser.Math.bezierInterpolation(v, k);}); Is there any way I can get data about the bezier curve in real time? I understand there is a callback function for whenever the tween is updated (onUpdateCallback), but I'm trying to extract data related to where the sprite is on the curve. If you look at the diagram below, I have a need to get the "Q1" coordinate ... demoTween.onUpdateCallback(function() {// need to get Q1 here }); Any ideas? I need q1 to determine how much the sprite will be rotated (it's an arrow). Link to comment Share on other sites More sharing options...
Recommended Posts