/**
* Tween.js - Licensed under the MIT license
* https://github.com/tweenjs/tween.js
* ----------------------------------------------
*
* See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
* Thank you all, you're awesome!
*/
var _Group = function () {
this._tweens = {};
this._tweensAddedDuringUpdate = {};
};
_Group.prototype = {
getAll: function () {
return Object.keys(this._tweens).map(function (tweenId) {
return this._tweens[tweenId];
}.bind(this));
},
removeAll: function () {
this._tweens = {};
},
add: function (tween) {
this._tweens[tween.getId()] = tween;
this._tweensAddedDuringUpdate[tween.getId()] = tween;
},
remove: function (tween) {
delete this._tweens[tween.getId()];
delete this._tweensAddedDuringUpdate[tween.getId()];
},
update: function (time, preserve) {
var tweenIds = Object.keys(this._tweens);
if (tweenIds.length === 0) {
return false;
}
time = time !== undefined ? time : TWEEN.now();
// Tweens are updated in "batches". If you add a new tween during an update, then the
// new tween will be updated in the next batch.
// If you remove a tween during an update, it may or may not be updated. However,
// if the removed tween was added during the current batch, then it will not be updated.
while (tweenIds.length > 0) {
this._tweensAddedDuringUpdate = {};
for (var i = 0; i < tweenIds.length; i++) {
var tween = this._tweens[tweenIds[i]];
if (tween && tween.update(time) === false) {
tween._isPlaying = false;
if (!preserve) {
delete this._tweens[tweenIds[i]];
}
}
}
tweenIds = Object.keys(this._tweensAddedDuringUpdate);
}
return true;
}
};
var TWEEN = new _Group();
TWEEN.Group = _Group;
TWEEN._nextId = 0;
TWEEN.nextId = function () {
return TWEEN._nextId++;
};
// Include a performance.now polyfill.
// In node.js, use process.hrtime.
if (typeof (self) === 'undefined' && typeof (process) !== 'undefined' && process.hrtime) {
TWEEN.now = function () {
var time = process.hrtime();
// Convert [seconds, nanoseconds] to milliseconds.
return time[0] * 1000 + time[1] / 1000000;
};
}
// In a browser, use self.performance.now if it is available.
else if (typeof (self) !== 'undefined' &&
self.performance !== undefined &&
self.performance.now !== undefined) {
// This must be bound, because directly assigning this function
// leads to an invocation exception in Chrome.
TWEEN.now = self.performance.now.bind(self.performance);
}
// Use Date.now if it is available.
else if (Date.now !== undefined) {
TWEEN.now = Date.now;
}
// Otherwise, use 'new Date().getTime()'.
else {
TWEEN.now = function () {
return new Date().getTime();
};
}
TWEEN.Tween = function (object, group) {
this._object = object;
this._valuesStart = {};
this._valuesEnd = {};
this._valuesStartRepeat = {};
this._duration = 1000;
this._repeat = 0;
this._repeatDelayTime = undefined;
this._yoyo = false;
this._isPlaying = false;
this._reversed = false;
this._delayTime = 0;
this._startTime = null;
this._easingFunction = TWEEN.Easing.Linear.None;
this._interpolationFunction = TWEEN.Interpolation.Linear;
this._chainedTweens = [];
this._onStartCallback = null;
this._onStartCallbackFired = false;
this._onUpdateCallback = null;
this._onRepeatCallback = null;
this._onCompleteCallback = null;
this._onStopCallback = null;
this._group = group || TWEEN;
this._id = TWEEN.nextId();
};
TWEEN.Tween.prototype = {
getId: function () {
return this._id;
},
isPlaying: function () {
return this._isPlaying;
},
to: function (properties, duration) {
this._valuesEnd = Object.create(properties);
if (duration !== undefined) {
this._duration = duration;
}
return this;
},
duration: function duration(d) {
this._duration = d;
return this;
},
start: function (time) {
this._group.add(this);
this._isPlaying = true;
this._onStartCallbackFired = false;
this._startTime = time !== undefined ? typeof time === 'string' ? TWEEN.now() + parseFloat(time) : time : TWEEN.now();
this._startTime += this._delayTime;
for (var property in this._valuesEnd) {
// Check if an Array was provided as property value
if (this._valuesEnd[property] instanceof Array) {
if (this._valuesEnd[property].length === 0) {
continue;
}
// Create a local copy of the Array with the start value at the front
this._valuesEnd[property] = [this._object[property]].concat(this._valuesEnd[property]);
}
// If `to()` specifies a property that doesn't exist in the source object,
// we should not set that property in the object
if (this._object[property] === undefined) {
continue;
}
// Save the starting value.
this._valuesStart[property] = this._object[property];
if ((this._valuesStart[property] instanceof Array) === false) {
this._valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings
}
this._valuesStartRepeat[property] = this._valuesStart[property] || 0;
}
return this;
},
stop: function () {
if (!this._isPlaying) {
return this;
}
this._group.remove(this);
this._isPlaying = false;
if (this._onStopCallback !== null) {
this._onStopCallback(this._object);
}
this.stopChainedTweens();
return this;
},
end: function () {
this.update(Infinity);
return this;
},
stopChainedTweens: function () {
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
this._chainedTweens[i].stop();
}
},
group: function (group) {
this._group = group;
return this;
},
delay: function (amount) {
this._delayTime = amount;
return this;
},
repeat: function (times) {
this._repeat = times;
return this;
},
repeatDelay: function (amount) {
this._repeatDelayTime = amount;
return this;
},
yoyo: function (yoyo) {
this._yoyo = yoyo;
return this;
},
easing: function (easingFunction) {
this._easingFunction = easingFunction;
return this;
},
interpolation: function (interpolationFunction) {
this._interpolationFunction = interpolationFunction;
return this;
},
chain: function () {
this._chainedTweens = arguments;
return this;
},
onStart: function (callback) {
this._onStartCallback = callback;
return this;
},
onUpdate: function (callback) {
this._onUpdateCallback = callback;
return this;
},
onRepeat: function onRepeat(callback) {
this._onRepeatCallback = callback;
return this;
},
onComplete: function (callback) {
this._onCompleteCallback = callback;
return this;
},
onStop: function (callback) {
this._onStopCallback = callback;
return this;
},
update: function (time) {
var property;
var elapsed;
var value;
console.log(time,this._startTime);
if (time < this._startTime) {
return true;
}
if (this._onStartCallbackFired === false) {
if (this._onStartCallback !== null) {
this._onStartCallback(this._object);
}
this._onStartCallbackFired = true;
}
elapsed = (time - this._startTime) / this._duration;
elapsed = (this._duration === 0 || elapsed > 1) ? 1 : elapsed;
value = this._easingFunction(elapsed);
for (property in this._valuesEnd) {
// Don't update properties that do not exist in the source object
if (this._valuesStart[property] === undefined) {
continue;
}
var start = this._valuesStart[property] || 0;
var end = this._valuesEnd[property];
if (end instanceof Array) {
this._object[property] = this._interpolationFunction(end, value);
} else {
// Parses relative end values with start as base (e.g.: +10, -3)
if (typeof (end) === 'string') {
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
end = start + parseFloat(end);
} else {
end = parseFloat(end);
}
}
// Protect against non numeric properties.
if (typeof (end) === 'number') {
没有合适的资源?快使用搜索试试~ 我知道了~
精品射击源码.zip源码cocos creator项目源码下载
共2221个文件
meta:1166个
json:402个
png:368个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 26 浏览量
2022-03-18
08:49:11
上传
评论
收藏 10.63MB ZIP 举报
温馨提示
精品射击源码.zip源码cocos creator项目源码下载精品射击源码.zip源码cocos creator项目源码下载 1.上线产品适合个人学习技术做项目参考 2.开发脚本为javsScropt或者typeScript 3.上线产品适合小公司开发游戏项目参考
资源推荐
资源详情
资源评论
收起资源包目录
精品射击源码.zip源码cocos creator项目源码下载 (2221个子文件)
Thumbs.db 186KB
Thumbs.db 100KB
Thumbs.db 96KB
Thumbs.db 73KB
Thumbs.db 59KB
Thumbs.db 46KB
Thumbs.db 41KB
Thumbs.db 37KB
Thumbs.db 32KB
Thumbs.db 30KB
Thumbs.db 11KB
Thumbs.db 10KB
Thumbs.db 9KB
editor.fire 549KB
test.fire 443KB
main.fire 138KB
game_single.fire 120KB
game.fire 79KB
launch.fire 19KB
loading.fire 17KB
num5_font.fnt 2KB
num3_font.fnt 1KB
num4_font.fnt 1KB
num2_font.fnt 1KB
num1_font.fnt 1KB
num6_font.fnt 1KB
bg4.jpg 239KB
white_bg.jpg 1KB
Tween.js 15KB
RequestAnimationFrame.js 1KB
use_v2.1.x_cc.Action.js 975B
SceneConfigTable.json 203KB
WXNameTable.json 102KB
TTNameTable.json 102KB
SceneConfigTable2.json 82KB
SceneConfigTable3.json 47KB
SceneConfigTable4.json 42KB
LevelConfigTable.json 39KB
LevelConfigTable2.json 15KB
LevelConfigTable4.json 12KB
xxjiesuan_ske.json 11KB
xiyouBX_ske.json 10KB
LevelConfigTable3.json 5KB
NewProject_ske.json 5KB
NewProject_ske.json 3KB
NewProject_ske.json 3KB
NewProject_ske.json 3KB
qianghuaCG_ske.json 2KB
project.json 2KB
ItemConfigTable.json 1KB
Scene-244.json 1KB
Scene-237.json 1KB
Scene-133.json 1KB
Scene-102.json 1KB
Scene-15.json 1011B
Scene-140.json 1001B
Scene-79.json 967B
Scene-95.json 963B
Scene-192.json 962B
Scene-234.json 948B
Scene-131.json 945B
Scene-27.json 933B
Scene-143.json 925B
Scene-166.json 918B
Scene-129.json 918B
Scene-85.json 909B
Scene-72.json 907B
Scene-71.json 906B
Scene-41.json 896B
Scene-178.json 891B
TaskConfigTable.json 890B
Scene-88.json 888B
Scene-146.json 879B
Scene-7.json 875B
Scene-188.json 867B
Scene-65.json 867B
Scene-197.json 865B
Scene-60.json 864B
Scene-193.json 856B
Scene-16.json 855B
Scene-142.json 854B
Scene-207.json 851B
Scene-236.json 848B
Scene-9.json 847B
Scene-82.json 846B
Scene-173.json 842B
Scene-76.json 839B
Scene-226.json 832B
Scene-141.json 829B
Scene-219.json 828B
Scene-239.json 827B
Scene-107.json 827B
Scene-124.json 826B
Scene-125.json 823B
Scene-43.json 822B
Scene-225.json 821B
Scene-18.json 821B
Scene-54.json 820B
Scene-103.json 819B
Scene-147.json 817B
共 2221 条
- 1
- 2
- 3
- 4
- 5
- 6
- 23
资源评论
yxkfw
- 粉丝: 80
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功