@lightningjs/renderer 2.20.2 → 2.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/core/Autosizer.d.ts +9 -3
- package/dist/src/core/Autosizer.js +38 -17
- package/dist/src/core/Autosizer.js.map +1 -1
- package/dist/src/core/CoreNode.d.ts +1 -1
- package/dist/src/core/lib/WebGlContextWrapper.d.ts +5 -5
- package/dist/src/core/renderers/CoreShaderNode.d.ts +6 -0
- package/dist/src/core/renderers/CoreShaderNode.js +2 -0
- package/dist/src/core/renderers/CoreShaderNode.js.map +1 -1
- package/dist/src/core/renderers/canvas/CanvasRenderer.js +22 -38
- package/dist/src/core/renderers/canvas/CanvasRenderer.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlCoreCtxTexture.js +1 -1
- package/dist/src/core/renderers/webgl/WebGlCoreCtxTexture.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlCtxTexture.js +1 -1
- package/dist/src/core/renderers/webgl/WebGlCtxTexture.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlRenderOp.d.ts +3 -2
- package/dist/src/core/renderers/webgl/WebGlRenderOp.js +3 -1
- package/dist/src/core/renderers/webgl/WebGlRenderOp.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlRenderer.js +17 -10
- package/dist/src/core/renderers/webgl/WebGlRenderer.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.d.ts +1 -0
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.js +12 -0
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.js.map +1 -1
- package/dist/src/core/shaders/webgl/Default.js +6 -7
- package/dist/src/core/shaders/webgl/Default.js.map +1 -1
- package/dist/src/core/shaders/webgl/SdfShader.js +6 -7
- package/dist/src/core/shaders/webgl/SdfShader.js.map +1 -1
- package/dist/src/main-api/Inspector.js +5 -6
- package/dist/src/main-api/Inspector.js.map +1 -1
- package/dist/tsconfig.dist.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/renderers/webgl/WebGlCoreCtxTexture.ts +1 -2
- package/src/main-api/Inspector.ts +5 -6
- package/dist/src/core/AutosizeManager.d.ts +0 -30
- package/dist/src/core/AutosizeManager.js +0 -159
- package/dist/src/core/AutosizeManager.js.map +0 -1
- package/dist/src/core/animations/Animation.d.ts +0 -16
- package/dist/src/core/animations/Animation.js +0 -111
- package/dist/src/core/animations/Animation.js.map +0 -1
- package/dist/src/core/animations/CoreTransition.d.ts +0 -24
- package/dist/src/core/animations/CoreTransition.js +0 -63
- package/dist/src/core/animations/CoreTransition.js.map +0 -1
- package/dist/src/core/animations/Playback.d.ts +0 -62
- package/dist/src/core/animations/Playback.js +0 -155
- package/dist/src/core/animations/Playback.js.map +0 -1
- package/dist/src/core/animations/Transition.d.ts +0 -25
- package/dist/src/core/animations/Transition.js +0 -63
- package/dist/src/core/animations/Transition.js.map +0 -1
- package/dist/src/core/animations/utils.d.ts +0 -2
- package/dist/src/core/animations/utils.js +0 -137
- package/dist/src/core/animations/utils.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Animation.js","sourceRoot":"","sources":["../../../../src/core/animations/Animation.ts"],"names":[],"mappings":"AAoBA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAuB,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,QAAQ,EAAE,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAO/D,MAAM,cAAc,GAAG,CACrB,MAAS,EACT,eAAmC,EACnC,SAAiB,EACjB,MAAc,EACd,OAA8B,EACC,EAAE;IACjC,MAAM,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IAEhC,MAAM,gBAAgB,GAAiC,EAAE,CAAC;IAC1D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC1C,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|
|
1
|
-
import type { TimingFunction } from "./utils";
|
|
2
|
-
export interface TransitionSettings {
|
|
3
|
-
to: number;
|
|
4
|
-
from?: number | null;
|
|
5
|
-
duration?: number;
|
|
6
|
-
delay?: number;
|
|
7
|
-
easing?: string | TimingFunction;
|
|
8
|
-
}
|
|
9
|
-
export type TransitionValueTypes = number | TransitionSettings | string | (number | TransitionSettings | string)[];
|
|
10
|
-
export default class Transition {
|
|
11
|
-
private data;
|
|
12
|
-
currentValue: number | null;
|
|
13
|
-
applyProgress: (from: number, to: number, p: number) => number;
|
|
14
|
-
constructor(from: number | null, to: number, duration: number, delay: number, easing: TimingFunction | null);
|
|
15
|
-
applyEasedProgress(from: number, to: number, p: number): number;
|
|
16
|
-
applyLinearProgress(from: number, to: number, p: number): number;
|
|
17
|
-
update(animationTime: number): number;
|
|
18
|
-
set from(value: number | null);
|
|
19
|
-
get from(): number | null;
|
|
20
|
-
get to(): number;
|
|
21
|
-
get start(): number;
|
|
22
|
-
get end(): number;
|
|
23
|
-
get easing(): TimingFunction | null;
|
|
24
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* If not stated otherwise in this file or this component's LICENSE file the
|
|
3
|
-
* following copyright and licenses apply:
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2023 Comcast Cable Communications Management, LLC.
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the License);
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
export default class Transition {
|
|
20
|
-
data;
|
|
21
|
-
currentValue = null;
|
|
22
|
-
applyProgress = this.applyLinearProgress;
|
|
23
|
-
constructor(from, to, duration, delay, easing) {
|
|
24
|
-
this.data = [from, to, duration, delay, easing];
|
|
25
|
-
if (easing !== null) {
|
|
26
|
-
this.applyProgress = this.applyEasedProgress;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
// This function only gets called if an easing function is provided
|
|
30
|
-
applyEasedProgress(from, to, p) {
|
|
31
|
-
return from + (to - from) * this.data[4](p);
|
|
32
|
-
}
|
|
33
|
-
// This function gets called if no easing function is provided (linear)
|
|
34
|
-
applyLinearProgress(from, to, p) {
|
|
35
|
-
return from + (to - from) * p;
|
|
36
|
-
}
|
|
37
|
-
update(animationTime) {
|
|
38
|
-
const [from, to, start, end] = this.data;
|
|
39
|
-
//calculate progress of transition
|
|
40
|
-
let p = (animationTime - start) / (end - start);
|
|
41
|
-
return this.currentValue = this.applyProgress(from, to, p);
|
|
42
|
-
}
|
|
43
|
-
//only settable property is 'from' will be used on start of animation
|
|
44
|
-
set from(value) {
|
|
45
|
-
this.data[0] = value;
|
|
46
|
-
}
|
|
47
|
-
get from() {
|
|
48
|
-
return this.data[0];
|
|
49
|
-
}
|
|
50
|
-
get to() {
|
|
51
|
-
return this.data[1];
|
|
52
|
-
}
|
|
53
|
-
get start() {
|
|
54
|
-
return this.data[2];
|
|
55
|
-
}
|
|
56
|
-
get end() {
|
|
57
|
-
return this.data[3];
|
|
58
|
-
}
|
|
59
|
-
get easing() {
|
|
60
|
-
return this.data[4];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=CoreTransition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CoreTransition.js","sourceRoot":"","sources":["../../../../src/core/animations/CoreTransition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAkCH,MAAM,CAAC,OAAO,OAAO,UA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O,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from '../../common/EventEmitter.js';
|
|
2
|
-
import type { AnimationManager } from './AnimationManager.js';
|
|
3
|
-
import { type TimingFunction } from './utils.js';
|
|
4
|
-
export declare enum StopMethodFlags {
|
|
5
|
-
Immediate = 0,
|
|
6
|
-
Reset = 1,
|
|
7
|
-
Reverse = 2
|
|
8
|
-
}
|
|
9
|
-
export type StopMethodOptions = 'reverse' | 'reset' | 'immediate';
|
|
10
|
-
export declare const getStopMethodFlag: (method: string | undefined) => StopMethodFlags;
|
|
11
|
-
export interface PlaybackSettings {
|
|
12
|
-
delay: number;
|
|
13
|
-
duration: number;
|
|
14
|
-
easing: string | TimingFunction;
|
|
15
|
-
loop: boolean;
|
|
16
|
-
repeat: number;
|
|
17
|
-
reverse: boolean;
|
|
18
|
-
stopMethod: StopMethodOptions;
|
|
19
|
-
}
|
|
20
|
-
export declare enum PlaybackState {
|
|
21
|
-
Idle = 0,
|
|
22
|
-
Destroyed = 1,
|
|
23
|
-
Stopped = 2,
|
|
24
|
-
Finished = 3,
|
|
25
|
-
Paused = 4,
|
|
26
|
-
Playing = 5,
|
|
27
|
-
Stopping = 6
|
|
28
|
-
}
|
|
29
|
-
export declare const PlaybackSettingsKeys: {
|
|
30
|
-
delay: boolean;
|
|
31
|
-
duration: boolean;
|
|
32
|
-
easing: boolean;
|
|
33
|
-
loop: boolean;
|
|
34
|
-
repeat: boolean;
|
|
35
|
-
reverse: boolean;
|
|
36
|
-
stopMethod: boolean;
|
|
37
|
-
};
|
|
38
|
-
export declare function getPlaybackId(): number;
|
|
39
|
-
export default class Playback extends EventEmitter {
|
|
40
|
-
readonly animationManager: AnimationManager;
|
|
41
|
-
readonly id: number;
|
|
42
|
-
delay: number;
|
|
43
|
-
duration: number;
|
|
44
|
-
easing: TimingFunction | null;
|
|
45
|
-
loop: boolean;
|
|
46
|
-
repeat: number;
|
|
47
|
-
reverse: boolean;
|
|
48
|
-
stopMethod: StopMethodFlags;
|
|
49
|
-
state: PlaybackState;
|
|
50
|
-
startTime: number | null;
|
|
51
|
-
pauseTime: number | null;
|
|
52
|
-
endTime: number | null;
|
|
53
|
-
currentTime: number;
|
|
54
|
-
iteration: number;
|
|
55
|
-
constructor(animationManager: AnimationManager, settings?: Partial<PlaybackSettings>);
|
|
56
|
-
update(currentFrameTime: number): void;
|
|
57
|
-
updateValues(currentTime: number): void;
|
|
58
|
-
applyStartValues(): void;
|
|
59
|
-
start(): this;
|
|
60
|
-
stop(): void;
|
|
61
|
-
finish(): void;
|
|
62
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* If not stated otherwise in this file or this component's LICENSE file the
|
|
3
|
-
* following copyright and licenses apply:
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2023 Comcast Cable Communications Management, LLC.
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the License);
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
import { EventEmitter } from '../../common/EventEmitter.js';
|
|
20
|
-
import { normalizeTimingFunction } from './utils.js';
|
|
21
|
-
export var StopMethodFlags;
|
|
22
|
-
(function (StopMethodFlags) {
|
|
23
|
-
StopMethodFlags[StopMethodFlags["Immediate"] = 0] = "Immediate";
|
|
24
|
-
StopMethodFlags[StopMethodFlags["Reset"] = 1] = "Reset";
|
|
25
|
-
StopMethodFlags[StopMethodFlags["Reverse"] = 2] = "Reverse";
|
|
26
|
-
})(StopMethodFlags || (StopMethodFlags = {}));
|
|
27
|
-
export const getStopMethodFlag = (method) => {
|
|
28
|
-
if (method === undefined || method === 'immediate') {
|
|
29
|
-
return StopMethodFlags.Immediate;
|
|
30
|
-
}
|
|
31
|
-
switch (method) {
|
|
32
|
-
case 'reverse':
|
|
33
|
-
return StopMethodFlags.Reverse;
|
|
34
|
-
case 'reset':
|
|
35
|
-
return StopMethodFlags.Reset;
|
|
36
|
-
}
|
|
37
|
-
return StopMethodFlags.Immediate;
|
|
38
|
-
};
|
|
39
|
-
export var PlaybackState;
|
|
40
|
-
(function (PlaybackState) {
|
|
41
|
-
PlaybackState[PlaybackState["Idle"] = 0] = "Idle";
|
|
42
|
-
PlaybackState[PlaybackState["Destroyed"] = 1] = "Destroyed";
|
|
43
|
-
PlaybackState[PlaybackState["Stopped"] = 2] = "Stopped";
|
|
44
|
-
PlaybackState[PlaybackState["Finished"] = 3] = "Finished";
|
|
45
|
-
PlaybackState[PlaybackState["Paused"] = 4] = "Paused";
|
|
46
|
-
PlaybackState[PlaybackState["Playing"] = 5] = "Playing";
|
|
47
|
-
PlaybackState[PlaybackState["Stopping"] = 6] = "Stopping";
|
|
48
|
-
})(PlaybackState || (PlaybackState = {}));
|
|
49
|
-
export const PlaybackSettingsKeys = {
|
|
50
|
-
delay: true,
|
|
51
|
-
duration: true,
|
|
52
|
-
easing: true,
|
|
53
|
-
loop: true,
|
|
54
|
-
repeat: true,
|
|
55
|
-
reverse: true,
|
|
56
|
-
stopMethod: true,
|
|
57
|
-
};
|
|
58
|
-
//freeze the keys object to prevent modification
|
|
59
|
-
Object.freeze(PlaybackSettingsKeys);
|
|
60
|
-
/**
|
|
61
|
-
* Returns a new unique ID
|
|
62
|
-
*/
|
|
63
|
-
let playbackId = 1;
|
|
64
|
-
export function getPlaybackId() {
|
|
65
|
-
return playbackId++;
|
|
66
|
-
}
|
|
67
|
-
export default class Playback extends EventEmitter {
|
|
68
|
-
animationManager;
|
|
69
|
-
//id
|
|
70
|
-
id = getPlaybackId();
|
|
71
|
-
//settings
|
|
72
|
-
delay;
|
|
73
|
-
duration;
|
|
74
|
-
easing;
|
|
75
|
-
loop;
|
|
76
|
-
repeat;
|
|
77
|
-
reverse;
|
|
78
|
-
stopMethod;
|
|
79
|
-
//lifecycle
|
|
80
|
-
state = PlaybackState.Idle;
|
|
81
|
-
startTime = null;
|
|
82
|
-
pauseTime = null;
|
|
83
|
-
endTime = null;
|
|
84
|
-
currentTime = 0;
|
|
85
|
-
iteration = 0;
|
|
86
|
-
constructor(animationManager, settings = {}) {
|
|
87
|
-
super();
|
|
88
|
-
this.animationManager = animationManager;
|
|
89
|
-
this.delay = settings.delay ?? 0;
|
|
90
|
-
this.duration = settings.duration ?? 200;
|
|
91
|
-
this.easing = normalizeTimingFunction(settings.easing);
|
|
92
|
-
this.loop = settings.loop ?? false;
|
|
93
|
-
this.repeat = settings.repeat ?? 0;
|
|
94
|
-
this.reverse = settings.reverse ?? false;
|
|
95
|
-
this.stopMethod = getStopMethodFlag(settings.stopMethod);
|
|
96
|
-
}
|
|
97
|
-
update(currentFrameTime) {
|
|
98
|
-
let state = this.state;
|
|
99
|
-
let targetTime = currentFrameTime - this.startTime;
|
|
100
|
-
if (state === PlaybackState.Stopping) {
|
|
101
|
-
targetTime = this.duration - targetTime;
|
|
102
|
-
}
|
|
103
|
-
if (state === PlaybackState.Playing && targetTime > this.duration) {
|
|
104
|
-
targetTime = this.duration;
|
|
105
|
-
if (this.loop === true) {
|
|
106
|
-
this.iteration++;
|
|
107
|
-
this.startTime = currentFrameTime;
|
|
108
|
-
targetTime = 0;
|
|
109
|
-
if (this.repeat > 0 && this.iteration > this.repeat) {
|
|
110
|
-
this.stop();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
updateValues(currentTime) { }
|
|
116
|
-
applyStartValues() {
|
|
117
|
-
//needs to be implemented in subclass
|
|
118
|
-
}
|
|
119
|
-
start() {
|
|
120
|
-
const animationManager = this.animationManager;
|
|
121
|
-
this.startTime = animationManager.currentFrameTime + this.delay;
|
|
122
|
-
this.endTime = this.startTime + this.duration;
|
|
123
|
-
this.state = PlaybackState.Playing;
|
|
124
|
-
animationManager.register(this);
|
|
125
|
-
this.emit('start');
|
|
126
|
-
return this;
|
|
127
|
-
}
|
|
128
|
-
stop() {
|
|
129
|
-
const stopMethod = this.stopMethod;
|
|
130
|
-
if (stopMethod === StopMethodFlags.Immediate) {
|
|
131
|
-
this.finish();
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
if (stopMethod === StopMethodFlags.Reset) {
|
|
135
|
-
this.updateValues(0);
|
|
136
|
-
this.finish();
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
if (stopMethod === StopMethodFlags.Reverse) {
|
|
140
|
-
if (this.state === PlaybackState.Playing) {
|
|
141
|
-
this.state = PlaybackState.Stopping;
|
|
142
|
-
//adjust start time to account for current time
|
|
143
|
-
const currentFrameTime = this.animationManager.currentFrameTime;
|
|
144
|
-
const elapsedTime = currentFrameTime - this.startTime;
|
|
145
|
-
this.startTime = currentFrameTime - (this.duration - elapsedTime);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
finish() {
|
|
150
|
-
this.state = PlaybackState.Finished;
|
|
151
|
-
this.emit('finish');
|
|
152
|
-
this.animationManager.unregister(this);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
//# sourceMappingURL=Playback.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Playback.js","sourceRoot":"","sources":["../../../../src/core/animations/Playback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,uBAAuB,EAAuB,MAAM,YAAY,CAAC;AAE1E,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,+DAAS,CAAA;IACT,uDAAK,CAAA;IACL,2DAAO,CAAA;AACT,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAKD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,MAA0B,EACT,EAAE;IACnB,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QACnD,OAAO,eAAe,CAAC,SAAS,CAAC;IACnC,CAAC;IAED,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,eAAe,CAAC,OAAO,CAAC;QACjC,KAAK,OAAO;YACV,OAAO,eAAe,CAAC,KAAK,CAAC;IACjC,CAAC;IAED,OAAO,eAAe,CAAC,SAAS,CAAC;AACnC,CAAC,CAAC;AAYF,MAAM,CAAN,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,iDAAI,CAAA;IACJ,2DAAS,CAAA;IACT,uDAAO,CAAA;IACP,yDAAQ,CAAA;IACR,qDAAM,CAAA;IACN,uDAAO,CAAA;IACP,yDAAQ,CAAA;AACV,CAAC,EARW,aAAa,KAAb,aAAa,QAQxB;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;I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C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI;QACF,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,IAAI,UAAU,KAAK,eAAe,CAAC,SAAS,EAAE,CAAC;YAC7C,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QACD,IAAI,UAAU,KAAK,eAAe,CAAC,KAAK,EAAE,CAAC;YACzC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACrB,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QACD,IAAI,UAAU,KAAK,eAAe,CAAC,OAAO,EAAE,CAAC;YAC3C,IAAI,IAAI,CAAC,KAAK,KAAK,aAAa,CAAC,OAAO,EAAE,CAAC;gBACzC,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC;gBACpC,+CAA+C;gBAC/C,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC;gBAChE,MAAM,WAAW,GAAG,gBAAgB,GAAG,IAAI,CAAC,SAAU,CAAC;gBACvD,IAAI,CAAC,SAAS,GAAG,gBAAgB,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpB,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { TimingFunction } from './utils';
|
|
2
|
-
export interface TransitionSettings {
|
|
3
|
-
to: number;
|
|
4
|
-
from?: number | null;
|
|
5
|
-
duration?: number;
|
|
6
|
-
delay?: number;
|
|
7
|
-
easing?: string | TimingFunction;
|
|
8
|
-
}
|
|
9
|
-
export type TransitionableValue = number | number[];
|
|
10
|
-
export type TransitionValueTypes = number | TransitionSettings | string | (number | TransitionSettings | string)[];
|
|
11
|
-
export default class Transition {
|
|
12
|
-
private data;
|
|
13
|
-
currentValue: TransitionableValue | null;
|
|
14
|
-
applyProgress: (from: number, to: number, p: number) => number;
|
|
15
|
-
constructor(from: TransitionableValue | null, to: TransitionableValue, duration: number, delay: number, easing: TimingFunction | null);
|
|
16
|
-
applyEasedProgress(from: number, to: number, p: number): number;
|
|
17
|
-
applyLinearProgress(from: number, to: number, p: number): number;
|
|
18
|
-
update(animationTime: number): number;
|
|
19
|
-
set from(value: TransitionableValue | null);
|
|
20
|
-
get from(): TransitionableValue | null;
|
|
21
|
-
get to(): TransitionableValue;
|
|
22
|
-
get start(): number;
|
|
23
|
-
get end(): number;
|
|
24
|
-
get easing(): TimingFunction | null;
|
|
25
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* If not stated otherwise in this file or this component's LICENSE file the
|
|
3
|
-
* following copyright and licenses apply:
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2023 Comcast Cable Communications Management, LLC.
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the License);
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
export default class Transition {
|
|
20
|
-
data;
|
|
21
|
-
currentValue = null;
|
|
22
|
-
applyProgress = this.applyLinearProgress;
|
|
23
|
-
constructor(from, to, duration, delay, easing) {
|
|
24
|
-
this.data = [from, to, duration, delay, easing];
|
|
25
|
-
if (easing !== null) {
|
|
26
|
-
this.applyProgress = this.applyEasedProgress;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
// This function only gets called if an easing function is provided
|
|
30
|
-
applyEasedProgress(from, to, p) {
|
|
31
|
-
return from + (to - from) * this.data[4](p);
|
|
32
|
-
}
|
|
33
|
-
// This function gets called if no easing function is provided (linear)
|
|
34
|
-
applyLinearProgress(from, to, p) {
|
|
35
|
-
return from + (to - from) * p;
|
|
36
|
-
}
|
|
37
|
-
update(animationTime) {
|
|
38
|
-
const [from, to, start, end] = this.data;
|
|
39
|
-
//calculate progress of transition
|
|
40
|
-
let p = (animationTime - start) / (end - start);
|
|
41
|
-
return (this.currentValue = this.applyProgress(from, to, p));
|
|
42
|
-
}
|
|
43
|
-
//only settable property is 'from' will be used on start of animation
|
|
44
|
-
set from(value) {
|
|
45
|
-
this.data[0] = value;
|
|
46
|
-
}
|
|
47
|
-
get from() {
|
|
48
|
-
return this.data[0];
|
|
49
|
-
}
|
|
50
|
-
get to() {
|
|
51
|
-
return this.data[1];
|
|
52
|
-
}
|
|
53
|
-
get start() {
|
|
54
|
-
return this.data[2];
|
|
55
|
-
}
|
|
56
|
-
get end() {
|
|
57
|
-
return this.data[3];
|
|
58
|
-
}
|
|
59
|
-
get easing() {
|
|
60
|
-
return this.data[4];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=Transition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Transition.js","sourceRoot":"","sources":["../../../../src/core/animations/Transition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAoCH,MAAM,CAAC,OAAO,OAAO,UAAU;IACrB,IAAI,CAAuB;IACnC,YAAY,GAA+B,IAAI,CAAC;IAChD,aAAa,GAAG,IAAI,CA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E;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* If not stated otherwise in this file or this component's LICENSE file the
|
|
3
|
-
* following copyright and licenses apply:
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2023 Comcast Cable Communications Management, LLC.
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the License);
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
const tfCache = {};
|
|
20
|
-
const cubicBezierMap = {
|
|
21
|
-
ease: [0.25, 0.1, 0.25, 1.0],
|
|
22
|
-
'ease-in': [0.42, 0, 1.0, 1.0],
|
|
23
|
-
'ease-out': [0, 0, 0.58, 1.0],
|
|
24
|
-
'ease-in-out': [0.42, 0, 0.58, 1.0],
|
|
25
|
-
'ease-in-sine': [0.12, 0, 0.39, 0],
|
|
26
|
-
'ease-out-sine': [0.12, 0, 0.39, 0],
|
|
27
|
-
'ease-in-out-sine': [0.37, 0, 0.63, 1],
|
|
28
|
-
'ease-in-cubic': [0.32, 0, 0.67, 0],
|
|
29
|
-
'ease-out-cubic': [0.33, 1, 0.68, 1],
|
|
30
|
-
'ease-in-out-cubic': [0.65, 0, 0.35, 1],
|
|
31
|
-
'ease-in-circ': [0.55, 0, 1, 0.45],
|
|
32
|
-
'ease-out-circ': [0, 0.55, 0.45, 1],
|
|
33
|
-
'ease-in-out-circ': [0.85, 0, 0.15, 1],
|
|
34
|
-
'ease-in-back': [0.36, 0, 0.66, -0.56],
|
|
35
|
-
'ease-out-back': [0.34, 1.56, 0.64, 1],
|
|
36
|
-
'ease-in-out-back': [0.68, -0.6, 0.32, 1.6],
|
|
37
|
-
};
|
|
38
|
-
const createCubicBezierFunction = (a, b, c, d) => {
|
|
39
|
-
const xc = 3.0 * a;
|
|
40
|
-
const xb = 3.0 * (c - a) - xc;
|
|
41
|
-
const xa = 1.0 - xc - xb;
|
|
42
|
-
const yc = 3.0 * b;
|
|
43
|
-
const yb = 3.0 * (d - b) - yc;
|
|
44
|
-
const ya = 1.0 - yc - yb;
|
|
45
|
-
return function (time) {
|
|
46
|
-
if (time >= 1.0) {
|
|
47
|
-
return 1;
|
|
48
|
-
}
|
|
49
|
-
if (time <= 0) {
|
|
50
|
-
return 0;
|
|
51
|
-
}
|
|
52
|
-
let t = 0.5;
|
|
53
|
-
let cbx;
|
|
54
|
-
let cbxd;
|
|
55
|
-
let dx;
|
|
56
|
-
for (let it = 0; it < 20; it++) {
|
|
57
|
-
cbx = t * (t * (t * xa + xb) + xc);
|
|
58
|
-
dx = time - cbx;
|
|
59
|
-
if (dx > -1e-8 && dx < 1e-8) {
|
|
60
|
-
return t * (t * (t * ya + yb) + yc);
|
|
61
|
-
}
|
|
62
|
-
// Cubic bezier derivative.
|
|
63
|
-
cbxd = t * (t * (3 * xa) + 2 * xb) + xc;
|
|
64
|
-
if (cbxd > 1e-10 && cbxd < 1e-10) {
|
|
65
|
-
// Problematic. Fall back to binary search method.
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
t += dx / cbxd;
|
|
69
|
-
}
|
|
70
|
-
// Fallback: binary search method. This is more reliable when there are near-0 slopes.
|
|
71
|
-
let minT = 0;
|
|
72
|
-
let maxT = 1;
|
|
73
|
-
for (let it = 0; it < 20; it++) {
|
|
74
|
-
t = 0.5 * (minT + maxT);
|
|
75
|
-
cbx = t * (t * (t * xa + xb) + xc);
|
|
76
|
-
dx = time - cbx;
|
|
77
|
-
if (dx > -1e-8 && dx < 1e-8) {
|
|
78
|
-
// Solution found!
|
|
79
|
-
return t * (t * (t * ya + yb) + yc);
|
|
80
|
-
}
|
|
81
|
-
if (dx < 0) {
|
|
82
|
-
maxT = t;
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
minT = t;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return time;
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
const parseCubicBezier = (str) => {
|
|
92
|
-
//cubic-bezier(0.84, 0.52, 0.56, 0.6)
|
|
93
|
-
const regex = /-?\d*\.?\d+/g;
|
|
94
|
-
const match = str.match(regex);
|
|
95
|
-
if (match) {
|
|
96
|
-
const [num1, num2, num3, num4] = match;
|
|
97
|
-
const a = parseFloat(num1 || '0.42');
|
|
98
|
-
const b = parseFloat(num2 || '0');
|
|
99
|
-
const c = parseFloat(num3 || '1');
|
|
100
|
-
const d = parseFloat(num4 || '1');
|
|
101
|
-
const timing = createCubicBezierFunction(a, b, c, d);
|
|
102
|
-
tfCache[str] = timing;
|
|
103
|
-
return timing;
|
|
104
|
-
}
|
|
105
|
-
// parse failed, return linear
|
|
106
|
-
console.warn('cubic-bezier invalid' + str);
|
|
107
|
-
return null;
|
|
108
|
-
};
|
|
109
|
-
export const normalizeTimingFunction = (something) => {
|
|
110
|
-
if (something === undefined ||
|
|
111
|
-
(typeof something !== 'string' && typeof something !== 'function')) {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
//predefined timing functions
|
|
115
|
-
if (typeof something === 'function') {
|
|
116
|
-
return something;
|
|
117
|
-
}
|
|
118
|
-
if (tfCache[something] !== undefined) {
|
|
119
|
-
return tfCache[something];
|
|
120
|
-
}
|
|
121
|
-
if (cubicBezierMap[something] !== undefined) {
|
|
122
|
-
const [a, b, c, d] = cubicBezierMap[something];
|
|
123
|
-
const tf = createCubicBezierFunction(a, b, c, d);
|
|
124
|
-
tfCache[something] = tf;
|
|
125
|
-
return tf;
|
|
126
|
-
}
|
|
127
|
-
//custom cubic-bezier
|
|
128
|
-
if (something.startsWith('cubic-bezier')) {
|
|
129
|
-
const tf = parseCubicBezier(something);
|
|
130
|
-
if (tf !== null) {
|
|
131
|
-
tfCache[something] = tf;
|
|
132
|
-
}
|
|
133
|
-
return tf;
|
|
134
|
-
}
|
|
135
|
-
return null;
|
|
136
|
-
};
|
|
137
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/core/animations/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,MAAM,OAAO,GAAmC,EAAE,CAAC;AAEnD,MAAM,cAAc,GAAgC;IAClD,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC;IAC5B,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC;IAC9B,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC;IAC7B,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC;IACnC,cAAc,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAClC,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IACnC,kBAAkB,EAAE,CAAC,IAAI,EAAE,CAA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