Comparing version 0.2.0 to 0.2.1
@@ -6,3 +6,3 @@ // Generated by dts-bundle v0.7.2 | ||
export function Elapsed(): number; | ||
export function MainTicker(): ticker; | ||
export function MainTicker(): ITicker; | ||
export function Init(disableAutoTick?: boolean): boolean; | ||
@@ -21,27 +21,2 @@ export function SetTimescale(scale: number): void; | ||
export class Ticker extends EventList implements ITicker { | ||
state: State; | ||
elapsed: number; | ||
duration: number; | ||
tick: { | ||
(dt: number): void; | ||
} | undefined; | ||
SetParent(parent: ITicker, tick: { | ||
(dt: number): void; | ||
}): void; | ||
SetTimescale(scale: number): void; | ||
AddTickListener(cb: (dt: number) => void): void; | ||
RemoveTickListener(cb: (dt: number) => void): void; | ||
Tick(dt: number): void; | ||
Start(): void; | ||
Pause(): void; | ||
Resume(): void; | ||
Kill(): void; | ||
Skip(): void; | ||
Reset(): void; | ||
IsRunning(): boolean; | ||
IsFinished(): boolean; | ||
IsPaused(): boolean; | ||
} | ||
export interface ITween extends IControl { | ||
@@ -145,24 +120,2 @@ Default(): void; | ||
export enum State { | ||
Idle = 0, | ||
Run = 1, | ||
Pause = 2, | ||
Finished = 3, | ||
Killed = 4, | ||
} | ||
export abstract class EventList { | ||
first: INode | undefined; | ||
last: INode | undefined; | ||
length: number; | ||
Add(obj: any): void; | ||
Remove(obj: any): void; | ||
} | ||
export interface INode { | ||
node_valid: boolean; | ||
node_previous: INode | undefined; | ||
node_next: INode | undefined; | ||
node_list: EventList | undefined; | ||
} | ||
export interface IControl { | ||
@@ -183,1 +136,9 @@ elapsed: number; | ||
export enum State { | ||
Idle = 0, | ||
Run = 1, | ||
Pause = 2, | ||
Finished = 3, | ||
Killed = 4, | ||
} | ||
@@ -0,0 +0,0 @@ # How to contribute |
@@ -0,0 +0,0 @@ The MIT License (MIT) |
{ | ||
"name": "fatina", | ||
"description": "Small & Light tweening library for web / games", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "https://kefniark.github.io/Fatina/", | ||
@@ -6,0 +6,0 @@ "main": "build/fatina.js", |
@@ -14,2 +14,4 @@ ![Logo](logo.png) | ||
[![Coverage Status](https://coveralls.io/repos/github/kefniark/Fatina/badge.svg?branch=develop)](https://coveralls.io/github/kefniark/Fatina?branch=develop) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/f0451df42a9d43fa810f32f20005f9aa)](https://www.codacy.com/app/kefniark/Fatina?utm_source=github.com&utm_medium=referral&utm_content=kefniark/Fatina&utm_campaign=Badge_Grade) | ||
[![License](https://img.shields.io/npm/l/fatina.svg)](https://npmjs.org/package/fatina) | ||
@@ -16,0 +18,0 @@ ## Description |
@@ -25,7 +25,7 @@ import { Sequence as sequence } from './tweens/sequence'; | ||
// time updated internally (affected by timescale, pause, ...) | ||
export function Elapsed() { | ||
export function Elapsed(): number { | ||
return tickerManager.elapsed; | ||
} | ||
export function MainTicker() { | ||
export function MainTicker(): ITicker { | ||
if (!initialized) { | ||
@@ -32,0 +32,0 @@ Init(); |
@@ -198,3 +198,3 @@ import { ITicker } from '../core/interfaces/ITicker'; | ||
this.state = State.Killed | ||
this.state = State.Killed; | ||
this.EmitEvent(this.eventKill); | ||
@@ -201,0 +201,0 @@ } |
@@ -323,3 +323,3 @@ import { BaseTween } from './baseTween'; | ||
public SetEasing(type: EasingType | string): ITween { | ||
this.ease = this.Easing(type) | ||
this.ease = this.Easing(type); | ||
return this; | ||
@@ -326,0 +326,0 @@ } |
@@ -107,11 +107,11 @@ import * as test from 'tape'; | ||
t.equal(1, started) | ||
t.equal(10, elapsed) | ||
t.equal(0, completed) | ||
t.equal(1, started); | ||
t.equal(10, elapsed); | ||
t.equal(0, completed); | ||
fatina.Update(10); | ||
t.equal(1, started) | ||
t.equal(20, elapsed) | ||
t.equal(1, completed) | ||
t.equal(1, started); | ||
t.equal(20, elapsed); | ||
t.equal(1, completed); | ||
@@ -196,4 +196,4 @@ delay.Skip(); | ||
uiTicker.AddTickListener(() => console.log('add event')); | ||
uiTicker.RemoveTickListener(() => console.log('remove event')); | ||
uiTicker.AddTickListener(() => {}); | ||
uiTicker.RemoveTickListener(() => {}); | ||
uiTicker.Remove(undefined); | ||
@@ -213,3 +213,3 @@ | ||
t.equal(2, obj.x, 'check the game ticker is paused'); | ||
t.equal(1.5, obj.y, 'check the ui ticker is killed') | ||
t.equal(1.5, obj.y, 'check the ui ticker is killed'); | ||
@@ -216,0 +216,0 @@ gameTicker.Resume(); |
@@ -39,3 +39,2 @@ import * as test from 'tape'; | ||
.OnStepStart((tween) => { | ||
// console.log(' > Step Start ', stepStart, tween); | ||
if (start === 0 || complete > 0) { | ||
@@ -47,3 +46,2 @@ t.fail('OnStep() - event order issue'); | ||
.OnStepStart((tween) => { | ||
// console.log(' > Step End ', stepEnd, tween); | ||
if (start === 0 || complete > 0) { | ||
@@ -57,3 +55,2 @@ t.fail('OnStep() - event order issue'); | ||
duration += dt; | ||
// console.log('sequence update', update, dt) | ||
}) | ||
@@ -94,3 +91,3 @@ .OnComplete(() => { | ||
.Append(new Tween(obj, [ 'x', 'y' ]).To({ x: 0, y: 0 }, 5)) | ||
.OnComplete(() => complete++) | ||
.OnComplete(() => complete++); | ||
@@ -102,3 +99,3 @@ sequence.Start(); | ||
t.equal(1, complete, 'check the remains of the first tick was propagated to the second tween') | ||
t.equal(1, complete, 'check the remains of the first tick was propagated to the second tween'); | ||
t.end(); | ||
@@ -127,3 +124,3 @@ }); | ||
})) | ||
.OnComplete(() => complete++) | ||
.OnComplete(() => complete++); | ||
@@ -134,3 +131,3 @@ sequence.Start(); | ||
t.equal(1, complete, 'check both tween are executed') | ||
t.equal(1, complete, 'check both tween are executed'); | ||
t.end(); | ||
@@ -157,3 +154,3 @@ }); | ||
.OnUpdate((dt) => duration += dt) | ||
.OnComplete(() => complete++) | ||
.OnComplete(() => complete++); | ||
@@ -403,3 +400,3 @@ sequence.Start(); | ||
let obj = { x: 22 }; | ||
let sequence = new Sequence() | ||
new Sequence() | ||
.SetParent(ticker) | ||
@@ -412,7 +409,5 @@ .SetLoop(-1) | ||
ticker.Tick(3); | ||
console.log(sequence); | ||
ticker.Tick(3); | ||
console.log(sequence); | ||
t.end(); | ||
}); |
@@ -379,4 +379,4 @@ import * as test from 'tape'; | ||
t.equal(1, killed) | ||
t.equal(0, complete) | ||
t.equal(1, killed); | ||
t.equal(0, complete); | ||
@@ -418,9 +418,9 @@ t.end(); | ||
.OnStart(() => { | ||
throw new Error('Test Random User Exception') | ||
throw new Error('Test Random User Exception'); | ||
}) | ||
.OnUpdate(() => { | ||
throw new Error('Test Random User Exception') | ||
throw new Error('Test Random User Exception'); | ||
}) | ||
.OnComplete(() => { | ||
throw new Error('Test Random User Exception') | ||
throw new Error('Test Random User Exception'); | ||
}) | ||
@@ -427,0 +427,0 @@ .Start(); |
@@ -0,0 +0,0 @@ { |
@@ -1,22 +0,43 @@ | ||
'use strict'; | ||
"use strict"; | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const path = require("path"); | ||
const webpack = require("webpack"); | ||
const optimizeJsPlugin = require("optimize-js-plugin"); | ||
// Generate the description file d.ts | ||
function DtsBundlePlugin(){} | ||
DtsBundlePlugin.prototype.apply = function (compiler) { | ||
compiler.plugin("done", function () { | ||
var dts = require("dts-bundle"); | ||
dts.bundle({ | ||
name: "Fatina", | ||
baseDir: "lib", | ||
main: "./lib/src/fatina/index.d.ts", | ||
out: "../build/fatina.d.ts", | ||
exclude: (file, external) => { | ||
return file.indexOf("tests") !== -1; | ||
}, | ||
removeSource: true, | ||
verbose: false, | ||
outputAsModuleFolder: true // to use npm in-package typings | ||
}); | ||
}); | ||
}; | ||
// Object passed to webpack compiler | ||
module.exports = { | ||
entry: { | ||
'fatina': './src/fatina/index.ts', | ||
'fatina.min': './src/fatina/index.ts' | ||
"fatina": "./src/fatina/index.ts", | ||
"fatina.min": "./src/fatina/index.ts" | ||
}, | ||
output: { | ||
path: './build', | ||
filename: '[name].js', | ||
library: 'Fatina', | ||
libraryTarget: 'umd', | ||
path: "./build", | ||
filename: "[name].js", | ||
library: "Fatina", | ||
libraryTarget: "umd", | ||
umdNamedDefine: true | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.tsx', '.js', ''] | ||
extensions: [".ts", ".tsx", ".js", ""] | ||
}, | ||
@@ -26,3 +47,3 @@ devtool: "source-map", | ||
loaders: [ | ||
{ test: /\.tsx?$/, loader: 'ts-loader' } | ||
{ test: /\.tsx?$/, loader: "ts-loader" } | ||
] | ||
@@ -39,3 +60,3 @@ }, | ||
devServer: { | ||
contentBase: [path.join(__dirname, 'samples'), path.join(__dirname, 'build'), path.join(__dirname)], | ||
contentBase: [path.join(__dirname, "samples"), path.join(__dirname, "build"), path.join(__dirname)], | ||
compress: true, | ||
@@ -45,21 +66,1 @@ port: 8000 | ||
}; | ||
function DtsBundlePlugin(){} | ||
DtsBundlePlugin.prototype.apply = function (compiler) { | ||
compiler.plugin('done', function () { | ||
var dts = require('dts-bundle'); | ||
dts.bundle({ | ||
name: 'Fatina', | ||
baseDir: 'lib', | ||
main: './lib/src/fatina/index.d.ts', | ||
out: '../build/fatina.d.ts', | ||
exclude: function(file, external) { | ||
return file.indexOf('tests') !== -1; | ||
}, | ||
removeSource: true, | ||
verbose: false, | ||
outputAsModuleFolder: true // to use npm in-package typings | ||
}); | ||
}); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
619734
52
4728