add optional end function call to tweens
This commit is contained in:
parent
b589a742cf
commit
27fa286625
|
@ -53,7 +53,6 @@ var sprite = {
|
||||||
function advance() {
|
function advance() {
|
||||||
if (!self) return;
|
if (!self) return;
|
||||||
if (!self.gameobject) return;
|
if (!self.gameobject) return;
|
||||||
//self.path = playing.path;
|
|
||||||
self.frame = playing.frames[f].rect;
|
self.frame = playing.frames[f].rect;
|
||||||
self.rect = [self.frame.x, self.frame.y, self.frame.w, self.frame.h];
|
self.rect = [self.frame.x, self.frame.y, self.frame.w, self.frame.h];
|
||||||
self.update_dimensions();
|
self.update_dimensions();
|
||||||
|
|
|
@ -103,7 +103,7 @@ Ease.elastic = {
|
||||||
Ease.elastic.c4 = 2*Math.PI/3;
|
Ease.elastic.c4 = 2*Math.PI/3;
|
||||||
Ease.elastic.c5 = 2*Math.PI / 4.5;
|
Ease.elastic.c5 = 2*Math.PI / 4.5;
|
||||||
|
|
||||||
var tween = function(from, to, time, fn)
|
var tween = function(from, to, time, fn, endfn)
|
||||||
{
|
{
|
||||||
var start = profile.secs(profile.now());
|
var start = profile.secs(profile.now());
|
||||||
var update = function(dt) {
|
var update = function(dt) {
|
||||||
|
@ -114,6 +114,7 @@ var tween = function(from, to, time, fn)
|
||||||
fn(to);
|
fn(to);
|
||||||
if (stop.then) stop.then();
|
if (stop.then) stop.then();
|
||||||
stop();
|
stop();
|
||||||
|
endfn?.();
|
||||||
}
|
}
|
||||||
profile.endframe();
|
profile.endframe();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue