@akashic-extension/akashic-timeline
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -1,2 +0,2 @@ | ||
declare enum ActionType { | ||
export declare enum ActionType { | ||
Wait = 0, | ||
@@ -10,2 +10,1 @@ Call = 1, | ||
} | ||
export = ActionType; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ActionType = void 0; | ||
var ActionType; | ||
@@ -11,3 +13,2 @@ (function (ActionType) { | ||
ActionType[ActionType["Every"] = 6] = "Every"; | ||
})(ActionType || (ActionType = {})); | ||
module.exports = ActionType; | ||
})(ActionType = exports.ActionType || (exports.ActionType = {})); |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
declare module Easing { | ||
export declare module Easing { | ||
/** | ||
@@ -179,3 +179,18 @@ * 入力値をlinearした結果の現在位置を返す。 | ||
function easeInOutCirc(t: number, b: number, c: number, d: number): number; | ||
/** | ||
* 入力値を easeInOutBack した結果の現在位置を返す。 | ||
* @param t 経過時間 | ||
* @param b 開始位置 | ||
* @param c 終了位置 | ||
* @param d 所要時間 | ||
*/ | ||
function easeInOutBack(t: number, b: number, c: number, d: number): number; | ||
/** | ||
* 入力値を easeOutBounce した結果の現在位置を返す。 | ||
* @param t 経過時間 | ||
* @param b 開始位置 | ||
* @param c 終了位置 | ||
* @param d 所要時間 | ||
*/ | ||
function easeOutBounce(t: number, b: number, c: number, d: number): number; | ||
} | ||
export = Easing; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Easing = void 0; | ||
/** | ||
@@ -274,3 +276,46 @@ * Easing関数群。 | ||
Easing.easeInOutCirc = easeInOutCirc; | ||
})(Easing || (Easing = {})); | ||
module.exports = Easing; | ||
/** | ||
* 入力値を easeInOutBack した結果の現在位置を返す。 | ||
* @param t 経過時間 | ||
* @param b 開始位置 | ||
* @param c 終了位置 | ||
* @param d 所要時間 | ||
*/ | ||
function easeInOutBack(t, b, c, d) { | ||
var x = t / d; | ||
var c1 = 1.70158; | ||
var c2 = c1 * 1.525; | ||
var v = x < 0.5 | ||
? (Math.pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2)) / 2 | ||
: (Math.pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2; | ||
return b + c * v; | ||
} | ||
Easing.easeInOutBack = easeInOutBack; | ||
/** | ||
* 入力値を easeOutBounce した結果の現在位置を返す。 | ||
* @param t 経過時間 | ||
* @param b 開始位置 | ||
* @param c 終了位置 | ||
* @param d 所要時間 | ||
*/ | ||
function easeOutBounce(t, b, c, d) { | ||
var x = t / d; | ||
var n1 = 7.5625; | ||
var d1 = 2.75; | ||
var v; | ||
if (x < 1 / d1) { | ||
v = n1 * x * x; | ||
} | ||
else if (x < 2 / d1) { | ||
v = n1 * (x -= 1.5 / d1) * x + 0.75; | ||
} | ||
else if (x < 2.5 / d1) { | ||
v = n1 * (x -= 2.25 / d1) * x + 0.9375; | ||
} | ||
else { | ||
v = n1 * (x -= 2.625 / d1) * x + 0.984375; | ||
} | ||
return b + c * v; | ||
} | ||
Easing.easeOutBounce = easeOutBounce; | ||
})(Easing = exports.Easing || (exports.Easing = {})); |
@@ -1,2 +0,1 @@ | ||
declare type EasingType = (t: number, b: number, c: number, d: number) => number; | ||
export = EasingType; | ||
export declare type EasingType = (t: number, b: number, c: number, d: number) => number; |
@@ -1,5 +0,5 @@ | ||
export import Timeline = require("./Timeline"); | ||
export import Tween = require("./Tween"); | ||
export import TweenOption = require("./TweenOption"); | ||
export import Easing = require("./Easing"); | ||
export import TweenStateSerialization = require("./TweenStateSerialization"); | ||
export { Timeline } from "./Timeline"; | ||
export { Tween } from "./Tween"; | ||
export { TweenOption } from "./TweenOption"; | ||
export { Easing } from "./Easing"; | ||
export { TweenStateSerialization } from "./TweenStateSerialization"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Timeline = require("./Timeline"); | ||
exports.Tween = require("./Tween"); | ||
exports.Easing = require("./Easing"); | ||
var Timeline_1 = require("./Timeline"); | ||
Object.defineProperty(exports, "Timeline", { enumerable: true, get: function () { return Timeline_1.Timeline; } }); | ||
var Tween_1 = require("./Tween"); | ||
Object.defineProperty(exports, "Tween", { enumerable: true, get: function () { return Tween_1.Tween; } }); | ||
var Easing_1 = require("./Easing"); | ||
Object.defineProperty(exports, "Easing", { enumerable: true, get: function () { return Easing_1.Easing; } }); |
@@ -1,7 +0,7 @@ | ||
import Tween = require("./Tween"); | ||
import TweenOption = require("./TweenOption"); | ||
import { Tween } from "./Tween"; | ||
import { TweenOption } from "./TweenOption"; | ||
/** | ||
* タイムライン機能を提供するクラス。 | ||
*/ | ||
declare class Timeline { | ||
export declare class Timeline { | ||
/** | ||
@@ -54,2 +54,1 @@ * タイムラインが一時停止状態かどうかを表すフラグ。 | ||
} | ||
export = Timeline; |
"use strict"; | ||
var Tween = require("./Tween"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Timeline = void 0; | ||
var Tween_1 = require("./Tween"); | ||
/** | ||
@@ -24,3 +26,3 @@ * タイムライン機能を提供するクラス。 | ||
Timeline.prototype.create = function (target, option) { | ||
var t = new Tween(target, option); | ||
var t = new Tween_1.Tween(target, option); | ||
this._tweens.push(t); | ||
@@ -108,2 +110,2 @@ return t; | ||
}()); | ||
module.exports = Timeline; | ||
exports.Timeline = Timeline; |
@@ -1,4 +0,4 @@ | ||
import TweenOption = require("./TweenOption"); | ||
import EasingType = require("./EasingType"); | ||
import TweenStateSerialization = require("./TweenStateSerialization"); | ||
import { EasingType } from "./EasingType"; | ||
import { TweenOption } from "./TweenOption"; | ||
import { TweenStateSerialization } from "./TweenStateSerialization"; | ||
/** | ||
@@ -8,3 +8,3 @@ * オブジェクトの状態を変化させるアクションを定義するクラス。 | ||
*/ | ||
declare class Tween { | ||
export declare class Tween { | ||
/** | ||
@@ -200,2 +200,1 @@ * アクションの実行が一時停止状態かどうかを表すフラグ。 | ||
} | ||
export = Tween; |
"use strict"; | ||
var Easing = require("./Easing"); | ||
var ActionType = require("./ActionType"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Tween = void 0; | ||
var ActionType_1 = require("./ActionType"); | ||
var Easing_1 = require("./Easing"); | ||
/** | ||
@@ -45,3 +47,3 @@ * オブジェクトの状態を変化させるアクションを定義するクラス。 | ||
Tween.prototype.to = function (props, duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
var action = { | ||
@@ -51,3 +53,3 @@ input: props, | ||
easing: easing, | ||
type: ActionType.TweenTo, | ||
type: ActionType_1.ActionType.TweenTo, | ||
initialized: false | ||
@@ -67,5 +69,5 @@ }; | ||
Tween.prototype.by = function (props, duration, easing, multiply) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
if (multiply === void 0) { multiply = false; } | ||
var type = multiply ? ActionType.TweenByMult : ActionType.TweenBy; | ||
var type = multiply ? ActionType_1.ActionType.TweenByMult : ActionType_1.ActionType.TweenBy; | ||
var action = { | ||
@@ -96,3 +98,3 @@ input: props, | ||
duration: duration, | ||
type: ActionType.Wait, | ||
type: ActionType_1.ActionType.Wait, | ||
initialized: false | ||
@@ -110,3 +112,3 @@ }; | ||
func: func, | ||
type: ActionType.Call, | ||
type: ActionType_1.ActionType.Call, | ||
duration: 0, | ||
@@ -142,3 +144,3 @@ initialized: false | ||
var action = { | ||
type: ActionType.Cue, | ||
type: ActionType_1.ActionType.Cue, | ||
duration: Number(keys[keys.length - 1]), | ||
@@ -158,6 +160,6 @@ cue: q, | ||
Tween.prototype.every = function (func, duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
var action = { | ||
func: func, | ||
type: ActionType.Every, | ||
type: ActionType_1.ActionType.Every, | ||
easing: easing, | ||
@@ -176,3 +178,3 @@ duration: duration, | ||
Tween.prototype.fadeIn = function (duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
return this.to({ opacity: 1 }, duration, easing); | ||
@@ -186,3 +188,3 @@ }; | ||
Tween.prototype.fadeOut = function (duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
return this.to({ opacity: 0 }, duration, easing); | ||
@@ -198,3 +200,3 @@ }; | ||
Tween.prototype.moveTo = function (x, y, duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
return this.to({ x: x, y: y }, duration, easing); | ||
@@ -210,3 +212,3 @@ }; | ||
Tween.prototype.moveBy = function (x, y, duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
return this.by({ x: x, y: y }, duration, easing); | ||
@@ -221,3 +223,3 @@ }; | ||
Tween.prototype.moveX = function (x, duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
return this.to({ x: x }, duration, easing); | ||
@@ -232,3 +234,3 @@ }; | ||
Tween.prototype.moveY = function (y, duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
return this.to({ y: y }, duration, easing); | ||
@@ -243,3 +245,3 @@ }; | ||
Tween.prototype.rotateTo = function (angle, duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
return this.to({ angle: angle }, duration, easing); | ||
@@ -254,3 +256,3 @@ }; | ||
Tween.prototype.rotateBy = function (angle, duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
return this.by({ angle: angle }, duration, easing); | ||
@@ -266,3 +268,3 @@ }; | ||
Tween.prototype.scaleTo = function (scaleX, scaleY, duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
return this.to({ scaleX: scaleX, scaleY: scaleY }, duration, easing); | ||
@@ -278,3 +280,3 @@ }; | ||
Tween.prototype.scaleBy = function (scaleX, scaleY, duration, easing) { | ||
if (easing === void 0) { easing = Easing.linear; } | ||
if (easing === void 0) { easing = Easing_1.Easing.linear; } | ||
return this.by({ scaleX: scaleX, scaleY: scaleY }, duration, easing, true); | ||
@@ -298,6 +300,6 @@ }; | ||
} | ||
if (action.type === ActionType.Call && typeof action.func === "function") { | ||
if (action.type === ActionType_1.ActionType.Call && typeof action.func === "function") { | ||
action.func.call(this._target); | ||
} | ||
else if (action.type === ActionType.Cue && action.cue) { | ||
else if (action.type === ActionType_1.ActionType.Cue && action.cue) { | ||
for (var k = 0; k < action.cue.length; ++k) { | ||
@@ -307,3 +309,3 @@ action.cue[k].func.call(this._target); | ||
} | ||
else if (action.type === ActionType.Every && typeof action.func === "function") { | ||
else if (action.type === ActionType_1.ActionType.Every && typeof action.func === "function") { | ||
action.func.call(this._target, action.duration, 1); | ||
@@ -388,6 +390,6 @@ } | ||
switch (action.type) { | ||
case ActionType.Call: | ||
case ActionType_1.ActionType.Call: | ||
action.func.call(this._target); | ||
break; | ||
case ActionType.Every: | ||
case ActionType_1.ActionType.Every: | ||
var progress = action.easing(action.elapsed, 0, 1, action.duration); | ||
@@ -399,5 +401,5 @@ if (progress > 1) { | ||
break; | ||
case ActionType.TweenTo: | ||
case ActionType.TweenBy: | ||
case ActionType.TweenByMult: | ||
case ActionType_1.ActionType.TweenTo: | ||
case ActionType_1.ActionType.TweenBy: | ||
case ActionType_1.ActionType.TweenByMult: | ||
var keys = Object.keys(action.goal); | ||
@@ -419,3 +421,3 @@ for (var j = 0; j < keys.length; ++j) { | ||
break; | ||
case ActionType.Cue: | ||
case ActionType_1.ActionType.Cue: | ||
var cueAction = action.cue[action.cueIndex]; | ||
@@ -516,5 +518,5 @@ if (cueAction !== undefined && action.elapsed >= cueAction.time) { | ||
action.initialized = true; | ||
if (action.type !== ActionType.TweenTo | ||
&& action.type !== ActionType.TweenBy | ||
&& action.type !== ActionType.TweenByMult) { | ||
if (action.type !== ActionType_1.ActionType.TweenTo | ||
&& action.type !== ActionType_1.ActionType.TweenBy | ||
&& action.type !== ActionType_1.ActionType.TweenByMult) { | ||
return; | ||
@@ -527,9 +529,9 @@ } | ||
action.start[key] = this._target[key]; | ||
if (action.type === ActionType.TweenTo) { | ||
if (action.type === ActionType_1.ActionType.TweenTo) { | ||
action.goal[key] = action.input[key]; | ||
} | ||
else if (action.type === ActionType.TweenBy) { | ||
else if (action.type === ActionType_1.ActionType.TweenBy) { | ||
action.goal[key] = action.start[key] + action.input[key]; | ||
} | ||
else if (action.type === ActionType.TweenByMult) { | ||
else if (action.type === ActionType_1.ActionType.TweenByMult) { | ||
action.goal[key] = action.start[key] * action.input[key]; | ||
@@ -542,2 +544,2 @@ } | ||
}()); | ||
module.exports = Tween; | ||
exports.Tween = Tween; |
/** | ||
* Tweenに指定するオプション。 | ||
*/ | ||
interface TweenOption { | ||
export interface TweenOption { | ||
/** | ||
@@ -24,2 +24,1 @@ * ループ実行するかどうかを指定する。 | ||
} | ||
export = TweenOption; |
@@ -1,3 +0,3 @@ | ||
import ActionType = require("./ActionType"); | ||
interface TweenStateSerialization { | ||
import { ActionType } from "./ActionType"; | ||
export interface TweenStateSerialization { | ||
_stepIndex: number; | ||
@@ -17,2 +17,1 @@ _initialProp: any; | ||
} | ||
export = TweenStateSerialization; |
{ | ||
"name": "@akashic-extension/akashic-timeline", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "timeline library for akashic", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"prepublish": "npm run clean && npm run build", | ||
"prepare": "npm run prepublish", | ||
"prepare": "npm run clean && npm run build", | ||
"clean": "rimraf lib && rimraf spec/build", | ||
"build": "tsc -p ./", | ||
"doc": "typedoc --out ./doc --gaID UA-162208211-1", | ||
"doc": "typedoc --out ./doc", | ||
"lint": "npm run lint:ts && npm run lint:md", | ||
"lint:ts": "tslint -c tslint.json src/**/*.ts", | ||
"lint:ts": "eslint src/**/*.ts spec/**/*.ts --fix", | ||
"lint:md": "remark ./*.md --frail --no-stdout --quiet --rc-path ./.remarkrc", | ||
@@ -26,4 +25,9 @@ "test": "npm run test:compile && npm run test:jasmine && npm run lint", | ||
"@akashic/akashic-engine": "~3.0.0", | ||
"@akashic/eslint-config": "^0.1.2", | ||
"@types/jasmine": "^2.8.8", | ||
"@types/node": "6.0.46", | ||
"@typescript-eslint/eslint-plugin": "^4.14.1", | ||
"eslint": "^7.18.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jest": "^24.1.3", | ||
"istanbul": "^0.4.5", | ||
@@ -34,3 +38,2 @@ "jasmine": "~2.8.0", | ||
"rimraf": "^2.6.1", | ||
"tslint": "^5.4.3", | ||
"typedoc": "^0.17.8", | ||
@@ -37,0 +40,0 @@ "typescript": "^3.8.3" |
@@ -34,3 +34,3 @@ <p align="center"> | ||
使い方は [akashic-timelineの利用方法](./getstarted.md) を参照してください。 | ||
使い方は [akashic-timelineの利用方法](https://github.com/akashic-games/akashic-timeline/blob/master/getstarted.md) を参照してください。 | ||
詳細なリファレンスは [APIリファレンス](https://akashic-games.github.io/reference/akashic-timeline/index.html)を参照してください。 | ||
@@ -77,5 +77,5 @@ Akashic Engineの詳細な利用方法については、 [公式ページ](https://akashic-games.github.io/) を参照してください。 | ||
本リポジトリは MIT License の元で公開されています。 | ||
詳しくは [LICENSE](./LICENSE) をご覧ください。 | ||
詳しくは [LICENSE](https://github.com/akashic-games/akashic-timeline/blob/master/LICENSE) をご覧ください。 | ||
ただし、画像ファイルおよび音声ファイルは | ||
[CC BY 2.1 JP](https://creativecommons.org/licenses/by/2.1/jp/) の元で公開されています。 |
62353
1475
15
19