How to get X and Y for TweenPosition from A to B node?

Hi, I have two group nodes (Node A and Node B)
Node A have children which should move to Node B with TweenAnimation one by one.
Currently, the only way I do is switchParent(NodeB) and then playForward.
But, node's z-index is displayed in reverse order. Is there any way to move tween from A to B, but changing parent only after tween finishes animating?
Something like this:
var cards = [...];
cards.forEach(function(cardNode, i) { // cardNode have parent NodeA
var tween = cardNode.addScript('qc.TweenPosition');

tween.addListenerOnce(tween.onFinished, function (tween) {
var currentCard = tween.gameObject;

tween.from.x = cardNode.anchoredX; // wrong position if I don't use switchParent before
tween.from.y = cardNode.anchoredY; // same here. = (NodeB.width / 2); // same here I guess, I need it to be placed at NodeB's center. = 0;
tween.duration = 0.15;
tween.delay = i * 0.3; // one by one

Has invited:


Favor from: warlockn

I wrote a demo for this and you can refer to it.
var test = qc.defineBehaviour('qc.engine.test', qc.Behaviour, function() {
}, {
nodeA: qc.Serializer.NODE,
nodeB: qc.Serializer.NODE

test.prototype.onEnable = function() {
var self = this;

var i = 0;
self.nodeA.children.forEach(function(child) {
var tween = child.addScript('qc.TweenPosition');

self.addListener(tween.onFinished, function (tween) {
var currentCard = tween.gameObject;
}, self);

tween.from = new qc.Point(child.x, child.y); = self.nodeA.toLocal(self.nodeB.getWorldPosition());
tween.duration = 1.5;
tween.delay = (i++) * 0.3; // one by one



Favor from:

Thanks! solved it.

To reply to a question, please Login or registered