thank a lot @Sahil
// ┌------------------------------------------------------------------------------┐
// GLOBAL $$cam CLASS: _camera_
//└------------------------------------------------------------------------------┘
class _camera_{
constructor() {
this.tiker = null; //pixi tiker if need
this.tween = null; // tween stored each time scene reset
};
};
$$cam = new _camera_();
console.log9('$$cam: ', $$cam);
// $$cam.initialise();
_camera_.prototype.initialise = function() {
// initialise setup the tween each time scene reset (store the new tileMap)
this.tween = new TweenLite(SceneManager._scene._spriteset._tilemap, 0, {
pixi:{pivotX:0, pivotY:0},
ease: Elastic.easeOut.config(1, 0.3),
});
};
// $$cam.move(40,10,2);
_camera_.prototype.move = function(x,y, dur) {
if(!this.tween){this.initialise()};
this.tween.vars.pivotX = x;
this.tween.vars.pivotY = y;
this.tween._duration = dur;
this.tween.play();
console.log('this.tween: ', this.tween);
};
i have another noob question.
For performance reasons, I want to setup a new instance of tween each time the scene is created with the new target map.
In this example of how to initialize the tween, how can I set it up correctly?
So if i call
$$cam.move(40,10,2);
the play() seem to do nothing, do i have a mistake?
Do you have a recommended tutorial or thread based on this kind of use ?
this.tween.vars.pivotX = x;
this.tween.vars.pivotY = y;
this.tween._duration = dur;
this.tween.play();
this should do the jobs no ?