@akylas/nativescript 8.2.1 → 8.2.4-alpha.2
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/accessibility/index.ios.js +1 -1
- package/accessibility/index.ios.js.map +1 -1
- package/application/application-common.d.ts +4 -0
- package/application/application-common.js +8 -0
- package/application/application-common.js.map +1 -1
- package/application/index.android.d.ts +2 -2
- package/application/index.android.js +10 -3
- package/application/index.android.js.map +1 -1
- package/application/index.ios.js +5 -0
- package/application/index.ios.js.map +1 -1
- package/config/config.interface.d.ts +1 -1
- package/core-types/index.d.ts +1 -0
- package/core-types/index.js.map +1 -1
- package/css/LICENSE +9 -0
- package/css/Readme.md +278 -0
- package/css-value/LICENSE +9 -0
- package/css-value/Readme.md +45 -0
- package/css-value/UPGRADING.md +26 -0
- package/fetch/LICENSE +20 -0
- package/fetch/README.md +1 -0
- package/file-system/file-system-access.android.d.ts +1 -0
- package/file-system/file-system-access.android.js +1 -0
- package/file-system/file-system-access.android.js.map +1 -1
- package/file-system/file-system-access.ios.d.ts +2 -0
- package/file-system/file-system-access.ios.js +3 -0
- package/file-system/file-system-access.ios.js.map +1 -1
- package/file-system/index.js +17 -7
- package/file-system/index.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/js-libs/easysax/LICENSE +20 -0
- package/js-libs/easysax/README.md +46 -0
- package/js-libs/esprima/LICENSE.BSD +19 -0
- package/js-libs/esprima/README.md +24 -0
- package/js-libs/polymer-expressions/LICENSE +27 -0
- package/js-libs/polymer-expressions/README.md +0 -0
- package/package.json +5 -13
- package/platforms/README.md +1 -0
- package/platforms/android/widgets-release.aar +0 -0
- package/ui/action-bar/index.ios.js +7 -6
- package/ui/action-bar/index.ios.js.map +1 -1
- package/ui/animation/animation-common.d.ts +7 -4
- package/ui/animation/animation-common.js +55 -117
- package/ui/animation/animation-common.js.map +1 -1
- package/ui/animation/animation-interfaces.d.ts +3 -2
- package/ui/animation/index.android.d.ts +15 -14
- package/ui/animation/index.android.js +99 -22
- package/ui/animation/index.android.js.map +1 -1
- package/ui/animation/index.ios.d.ts +33 -16
- package/ui/animation/index.ios.js +256 -202
- package/ui/animation/index.ios.js.map +1 -1
- package/ui/animation/keyframe-animation.d.ts +0 -1
- package/ui/animation/keyframe-animation.js +51 -51
- package/ui/animation/keyframe-animation.js.map +1 -1
- package/ui/builder/xml2ui.js +1 -1
- package/ui/builder/xml2ui.js.map +1 -1
- package/ui/button/index.ios.js +1 -1
- package/ui/button/index.ios.js.map +1 -1
- package/ui/core/properties/index.d.ts +34 -6
- package/ui/core/properties/index.js +429 -643
- package/ui/core/properties/index.js.map +1 -1
- package/ui/core/view/index.android.d.ts +1 -0
- package/ui/core/view/index.android.js +5 -2
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.d.ts +5 -0
- package/ui/core/view/index.ios.d.ts +4 -2
- package/ui/core/view/index.ios.js +28 -10
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.d.ts +2 -0
- package/ui/core/view/view-common.js +16 -5
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.ios.js +2 -2
- package/ui/core/view-base/index.js +4 -5
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/editable-text-base/editable-text-base-common.js +2 -1
- package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
- package/ui/editable-text-base/index.android.d.ts +0 -1
- package/ui/editable-text-base/index.android.js +15 -14
- package/ui/editable-text-base/index.android.js.map +1 -1
- package/ui/frame/frame-common.d.ts +1 -1
- package/ui/frame/frame-common.js +15 -15
- package/ui/frame/frame-common.js.map +1 -1
- package/ui/frame/index.android.js +5 -2
- package/ui/frame/index.android.js.map +1 -1
- package/ui/gestures/index.android.js +1 -1
- package/ui/gestures/index.android.js.map +1 -1
- package/ui/gestures/touch-manager.js +2 -1
- package/ui/gestures/touch-manager.js.map +1 -1
- package/ui/html-view/html-view-common.js +2 -1
- package/ui/html-view/html-view-common.js.map +1 -1
- package/ui/image/image-common.js +2 -2
- package/ui/image/image-common.js.map +1 -1
- package/ui/label/index.ios.js +1 -1
- package/ui/label/index.ios.js.map +1 -1
- package/ui/layouts/root-layout/index.d.ts +5 -4
- package/ui/layouts/root-layout/root-layout-common.d.ts +5 -2
- package/ui/layouts/root-layout/root-layout-common.js +145 -168
- package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
- package/ui/list-view/list-view-common.js +2 -2
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/page-common.js +2 -1
- package/ui/page/page-common.js.map +1 -1
- package/ui/proxy-view-container/index.d.ts +2 -0
- package/ui/proxy-view-container/index.js +28 -0
- package/ui/proxy-view-container/index.js.map +1 -1
- package/ui/search-bar/search-bar-common.js +3 -2
- package/ui/search-bar/search-bar-common.js.map +1 -1
- package/ui/segmented-bar/segmented-bar-common.js +2 -1
- package/ui/segmented-bar/segmented-bar-common.js.map +1 -1
- package/ui/styling/background.android.js +2 -0
- package/ui/styling/background.android.js.map +1 -1
- package/ui/styling/background.ios.js +21 -5
- package/ui/styling/background.ios.js.map +1 -1
- package/ui/styling/css-animation-parser.js +3 -2
- package/ui/styling/css-animation-parser.js.map +1 -1
- package/ui/styling/style/index.d.ts +1 -0
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.d.ts +1 -0
- package/ui/styling/style-properties.js +58 -70
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.js +4 -10
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/switch/switch-common.js +2 -1
- package/ui/switch/switch-common.js.map +1 -1
- package/ui/tab-view/index.ios.d.ts +1 -0
- package/ui/tab-view/index.ios.js +54 -24
- package/ui/tab-view/index.ios.js.map +1 -1
- package/ui/tab-view/tab-view-common.js +5 -4
- package/ui/tab-view/tab-view-common.js.map +1 -1
- package/ui/text-base/index.android.js +10 -1
- package/ui/text-base/index.android.js.map +1 -1
- package/ui/text-base/index.d.ts +5 -0
- package/ui/text-base/index.ios.d.ts +2 -0
- package/ui/text-base/index.ios.js +144 -6
- package/ui/text-base/index.ios.js.map +1 -1
- package/ui/text-base/text-base-common.d.ts +3 -0
- package/ui/text-base/text-base-common.js +12 -0
- package/ui/text-base/text-base-common.js.map +1 -1
- package/ui/text-view/index.android.js +1 -11
- package/ui/text-view/index.android.js.map +1 -1
- package/ui/text-view/index.ios.js +1 -13
- package/ui/text-view/index.ios.js.map +1 -1
- package/ui/text-view/text-view-common.d.ts +0 -2
- package/ui/text-view/text-view-common.js +0 -6
- package/ui/text-view/text-view-common.js.map +1 -1
- package/utils/index.d.ts +6 -0
- package/utils/mainthread-helper.android.d.ts +1 -0
- package/utils/mainthread-helper.android.js +7 -0
- package/utils/mainthread-helper.android.js.map +1 -1
- package/utils/mainthread-helper.d.ts +6 -0
- package/utils/mainthread-helper.ios.d.ts +1 -0
- package/utils/mainthread-helper.ios.js +12 -0
- package/utils/mainthread-helper.ios.js.map +1 -1
- package/utils/utils-common.d.ts +1 -0
- package/utils/utils-common.js +24 -3
- package/utils/utils-common.js.map +1 -1
- package/platforms/android/nativescript.aar +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// Requires.
|
|
2
|
-
import { Color } from '../../color';
|
|
3
2
|
import { Trace } from '../../trace';
|
|
4
|
-
import {
|
|
3
|
+
import { Style } from '../styling/style';
|
|
4
|
+
import { CssAnimationProperty, InheritedCssProperty, ShorthandProperty } from '../core/properties';
|
|
5
5
|
export * from './animation-interfaces';
|
|
6
|
+
export function getPropertyFromKey(key, view) {
|
|
7
|
+
return CssAnimationProperty.properties[key] || ShorthandProperty.properties[key] || InheritedCssProperty.properties[key] || Style.prototype[key] || Object.getPrototypeOf(view)[key];
|
|
8
|
+
}
|
|
6
9
|
export var Properties;
|
|
7
10
|
(function (Properties) {
|
|
8
11
|
Properties.opacity = 'opacity';
|
|
@@ -13,6 +16,7 @@ export var Properties;
|
|
|
13
16
|
Properties.height = 'height';
|
|
14
17
|
Properties.width = 'width';
|
|
15
18
|
})(Properties || (Properties = {}));
|
|
19
|
+
export const AnimationNonAnimatableProperties = ['duration', 'valueSource', 'delay', 'iterations', 'curve', 'target'];
|
|
16
20
|
export class CubicBezierAnimationCurve {
|
|
17
21
|
constructor(x1, y1, x2, y2) {
|
|
18
22
|
this.x1 = x1;
|
|
@@ -30,12 +34,12 @@ export class AnimationBase {
|
|
|
30
34
|
Trace.write('Analyzing ' + animationDefinitions.length + ' animation definitions...', Trace.categories.Animation);
|
|
31
35
|
}
|
|
32
36
|
this._propertyAnimations = new Array();
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
|
|
37
|
+
animationDefinitions.forEach((animationDefinition) => {
|
|
38
|
+
if (animationDefinition.curve) {
|
|
39
|
+
animationDefinition.curve = this._resolveAnimationCurve(animationDefinition.curve);
|
|
36
40
|
}
|
|
37
|
-
this._propertyAnimations
|
|
38
|
-
}
|
|
41
|
+
this._propertyAnimations.push(...this._createPropertyAnimations(animationDefinition));
|
|
42
|
+
});
|
|
39
43
|
if (this._propertyAnimations.length === 0) {
|
|
40
44
|
throw new Error('Nothing to animate.');
|
|
41
45
|
}
|
|
@@ -97,127 +101,61 @@ export class AnimationBase {
|
|
|
97
101
|
this._isPlaying = false;
|
|
98
102
|
this._reject(new Error('Animation cancelled.'));
|
|
99
103
|
}
|
|
100
|
-
|
|
104
|
+
_createPropertyAnimations(animationDefinition) {
|
|
101
105
|
if (!animationDefinition.target) {
|
|
102
106
|
throw new Error('No animation target specified.');
|
|
103
107
|
}
|
|
108
|
+
const propertyAnimations = new Array();
|
|
104
109
|
for (const item in animationDefinition) {
|
|
105
110
|
const value = animationDefinition[item];
|
|
106
111
|
if (value === undefined) {
|
|
107
112
|
continue;
|
|
108
113
|
}
|
|
109
|
-
if ((item
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
else if (item === Properties.backgroundColor && !Color.isValid(animationDefinition.backgroundColor)) {
|
|
116
|
-
throw new Error(`Property ${item} must be valid color. Value: ${value}`);
|
|
117
|
-
}
|
|
118
|
-
else if (item === Properties.width || item === Properties.height) {
|
|
119
|
-
// Coerce input into a PercentLength object in case it's a string.
|
|
120
|
-
animationDefinition[item] = PercentLength.parse(value);
|
|
121
|
-
}
|
|
122
|
-
else if (item === Properties.rotate) {
|
|
123
|
-
const rotate = value;
|
|
124
|
-
if (typeof rotate !== 'number' && !(typeof rotate.x === 'number' && typeof rotate.y === 'number' && typeof rotate.z === 'number')) {
|
|
125
|
-
throw new Error(`Property ${rotate} must be valid number or Point3D. Value: ${value}`);
|
|
114
|
+
if (AnimationNonAnimatableProperties.indexOf(item) !== -1) {
|
|
115
|
+
if (item === 'duration' || item === 'delay' || item === 'iterations') {
|
|
116
|
+
if (typeof value !== 'number') {
|
|
117
|
+
throw new Error(`Property ${item} must be valid number. Value: ${value}`);
|
|
118
|
+
}
|
|
126
119
|
}
|
|
120
|
+
continue;
|
|
127
121
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (animationDefinition.opacity !== undefined) {
|
|
132
|
-
propertyAnimations.push({
|
|
133
|
-
target: animationDefinition.target,
|
|
134
|
-
property: Properties.opacity,
|
|
135
|
-
value: animationDefinition.opacity,
|
|
136
|
-
duration: animationDefinition.duration,
|
|
137
|
-
delay: animationDefinition.delay,
|
|
138
|
-
iterations: animationDefinition.iterations,
|
|
139
|
-
curve: animationDefinition.curve,
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
// backgroundColor
|
|
143
|
-
if (animationDefinition.backgroundColor !== undefined) {
|
|
144
|
-
propertyAnimations.push({
|
|
145
|
-
target: animationDefinition.target,
|
|
146
|
-
property: Properties.backgroundColor,
|
|
147
|
-
value: typeof animationDefinition.backgroundColor === 'string' ? new Color(animationDefinition.backgroundColor) : animationDefinition.backgroundColor,
|
|
148
|
-
duration: animationDefinition.duration,
|
|
149
|
-
delay: animationDefinition.delay,
|
|
150
|
-
iterations: animationDefinition.iterations,
|
|
151
|
-
curve: animationDefinition.curve,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
// translate
|
|
155
|
-
if (animationDefinition.translate !== undefined) {
|
|
156
|
-
propertyAnimations.push({
|
|
157
|
-
target: animationDefinition.target,
|
|
158
|
-
property: Properties.translate,
|
|
159
|
-
value: animationDefinition.translate,
|
|
160
|
-
duration: animationDefinition.duration,
|
|
161
|
-
delay: animationDefinition.delay,
|
|
162
|
-
iterations: animationDefinition.iterations,
|
|
163
|
-
curve: animationDefinition.curve,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
// scale
|
|
167
|
-
if (animationDefinition.scale !== undefined) {
|
|
168
|
-
propertyAnimations.push({
|
|
169
|
-
target: animationDefinition.target,
|
|
170
|
-
property: Properties.scale,
|
|
171
|
-
value: animationDefinition.scale,
|
|
172
|
-
duration: animationDefinition.duration,
|
|
173
|
-
delay: animationDefinition.delay,
|
|
174
|
-
iterations: animationDefinition.iterations,
|
|
175
|
-
curve: animationDefinition.curve,
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
// rotate
|
|
179
|
-
if (animationDefinition.rotate !== undefined) {
|
|
180
|
-
// Make sure the value of the rotation property is always Point3D
|
|
181
|
-
let rotationValue;
|
|
182
|
-
if (typeof animationDefinition.rotate === 'number') {
|
|
183
|
-
rotationValue = { x: 0, y: 0, z: animationDefinition.rotate };
|
|
122
|
+
let property = getPropertyFromKey(item, animationDefinition.target);
|
|
123
|
+
if (item === Properties.scale || item === Properties.translate) {
|
|
124
|
+
property = CssAnimationProperty.properties[item + 'X'];
|
|
184
125
|
}
|
|
185
|
-
|
|
186
|
-
|
|
126
|
+
if (property) {
|
|
127
|
+
let newValue = value;
|
|
128
|
+
const valueConverter = property.valueConverter;
|
|
129
|
+
if ((item === Properties.scale || item === Properties.translate) && typeof value !== 'object') {
|
|
130
|
+
throw new Error(`Property ${item} must be valid Pair. Value: ${value}`);
|
|
131
|
+
}
|
|
132
|
+
if (valueConverter) {
|
|
133
|
+
if (item === Properties.translate || item === Properties.rotate || item === Properties.scale) {
|
|
134
|
+
newValue = {};
|
|
135
|
+
if (Properties.rotate && typeof value !== 'object') {
|
|
136
|
+
newValue = { x: 0, y: 0, z: typeof value === 'string' ? valueConverter(value) : value };
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
Object.keys(value).forEach((k2) => {
|
|
140
|
+
newValue[k2] = typeof value[k2] === 'string' ? valueConverter(value[k2]) : value[k2];
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
newValue = typeof value === 'string' ? valueConverter(value) : value;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
propertyAnimations.push({
|
|
149
|
+
target: animationDefinition.target,
|
|
150
|
+
propertyName: item,
|
|
151
|
+
property,
|
|
152
|
+
value: newValue,
|
|
153
|
+
duration: animationDefinition.duration,
|
|
154
|
+
delay: animationDefinition.delay,
|
|
155
|
+
iterations: animationDefinition.iterations,
|
|
156
|
+
curve: animationDefinition.curve,
|
|
157
|
+
});
|
|
187
158
|
}
|
|
188
|
-
propertyAnimations.push({
|
|
189
|
-
target: animationDefinition.target,
|
|
190
|
-
property: Properties.rotate,
|
|
191
|
-
value: rotationValue,
|
|
192
|
-
duration: animationDefinition.duration,
|
|
193
|
-
delay: animationDefinition.delay,
|
|
194
|
-
iterations: animationDefinition.iterations,
|
|
195
|
-
curve: animationDefinition.curve,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
// height
|
|
199
|
-
if (animationDefinition.height !== undefined) {
|
|
200
|
-
propertyAnimations.push({
|
|
201
|
-
target: animationDefinition.target,
|
|
202
|
-
property: Properties.height,
|
|
203
|
-
value: animationDefinition.height,
|
|
204
|
-
duration: animationDefinition.duration,
|
|
205
|
-
delay: animationDefinition.delay,
|
|
206
|
-
iterations: animationDefinition.iterations,
|
|
207
|
-
curve: animationDefinition.curve,
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
// width
|
|
211
|
-
if (animationDefinition.width !== undefined) {
|
|
212
|
-
propertyAnimations.push({
|
|
213
|
-
target: animationDefinition.target,
|
|
214
|
-
property: Properties.width,
|
|
215
|
-
value: animationDefinition.width,
|
|
216
|
-
duration: animationDefinition.duration,
|
|
217
|
-
delay: animationDefinition.delay,
|
|
218
|
-
iterations: animationDefinition.iterations,
|
|
219
|
-
curve: animationDefinition.curve,
|
|
220
|
-
});
|
|
221
159
|
}
|
|
222
160
|
if (propertyAnimations.length === 0) {
|
|
223
161
|
throw new Error('No known animation properties specified');
|
|
@@ -227,7 +165,7 @@ export class AnimationBase {
|
|
|
227
165
|
static _getAnimationInfo(animation) {
|
|
228
166
|
return JSON.stringify({
|
|
229
167
|
target: animation.target.id,
|
|
230
|
-
|
|
168
|
+
propertyName: animation.propertyName,
|
|
231
169
|
value: animation.value,
|
|
232
170
|
duration: animation.duration,
|
|
233
171
|
delay: animation.delay,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation-common.js","sourceRoot":"","sources":["../../../../../packages/core/ui/animation/animation-common.ts"],"names":[],"mappings":"AAIA,YAAY;AACZ,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"animation-common.js","sourceRoot":"","sources":["../../../../../packages/core/ui/animation/animation-common.ts"],"names":[],"mappings":"AAIA,YAAY;AACZ,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGnG,cAAc,wBAAwB,CAAC;AAEvC,MAAM,UAAU,kBAAkB,CAAC,GAAW,EAAE,IAAU;IACzD,OAAO,oBAAoB,CAAC,UAAU,CAAC,GAAG,CA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1C,KAAK,EAAE,mBAAmB,CAAC,KAAK;iBAChC,CAAC,CAAC;aACH;SACD;QAED,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC3D;QAED,OAAO,kBAAkB,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,iBAAiB,CAAC,SAA4B;QAC3D,OAAO,IAAI,CAAC,SAAS,CAAC;YACrB,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE;YAC3B,YAAY,EAAE,SAAS,CAAC,YAAY;YACpC,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,QAAQ,EAAE,SAAS,CAAC,QAAQ;YAC5B,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,UAAU,EAAE,SAAS,CAAC,UAAU;YAChC,KAAK,EAAE,SAAS,CAAC,KAAK;SACtB,CAAC,CAAC;IACJ,CAAC;CACD"}
|
|
@@ -25,7 +25,8 @@ export interface Cancelable {
|
|
|
25
25
|
}
|
|
26
26
|
export interface PropertyAnimation {
|
|
27
27
|
target: View;
|
|
28
|
-
property:
|
|
28
|
+
property: any;
|
|
29
|
+
propertyName: string;
|
|
29
30
|
value: any;
|
|
30
31
|
duration?: number;
|
|
31
32
|
delay?: number;
|
|
@@ -56,5 +57,5 @@ export interface AnimationDefinitionInternal extends AnimationDefinition {
|
|
|
56
57
|
export interface IOSView extends View {
|
|
57
58
|
_suspendPresentationLayerUpdates(): any;
|
|
58
59
|
_resumePresentationLayerUpdates(): any;
|
|
59
|
-
|
|
60
|
+
_isPresentationLayerUpdateSuspended(): any;
|
|
60
61
|
}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { AnimationDefinitionInternal, AnimationPromise } from './animation-common';
|
|
1
|
+
import { AnimationDefinitionInternal, AnimationPromise, PropertyAnimation } from './animation-common';
|
|
2
|
+
import { View } from '../core/view';
|
|
2
3
|
import { AnimationBase, CubicBezierAnimationCurve } from './animation-common';
|
|
3
4
|
export * from './animation-common';
|
|
4
5
|
export { KeyframeAnimation, KeyframeAnimationInfo, KeyframeDeclaration, KeyframeInfo } from './keyframe-animation';
|
|
5
6
|
export declare function _resolveAnimationCurve(curve: string | CubicBezierAnimationCurve | android.view.animation.Interpolator | android.view.animation.LinearInterpolator): android.view.animation.Interpolator;
|
|
6
7
|
export declare class Animation extends AnimationBase {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
protected _animatorListener: android.animation.Animator.AnimatorListener;
|
|
9
|
+
protected _nativeAnimatorsArray: any;
|
|
10
|
+
protected _animatorSet: android.animation.AnimatorSet;
|
|
11
|
+
protected _animators: Array<android.animation.Animator>;
|
|
12
|
+
protected _propertyUpdateCallbacks: Array<Function>;
|
|
13
|
+
protected _propertyResetCallbacks: Array<Function>;
|
|
14
|
+
protected _valueSource: 'animation' | 'keyframe';
|
|
15
|
+
protected _target: View;
|
|
16
|
+
protected _resetOnFinish: boolean;
|
|
16
17
|
constructor(animationDefinitions: Array<AnimationDefinitionInternal>, playSequentially?: boolean);
|
|
17
18
|
play(resetOnFinish?: boolean): AnimationPromise;
|
|
18
19
|
cancel(): void;
|
|
19
20
|
_resolveAnimationCurve(curve: string | CubicBezierAnimationCurve | android.view.animation.Interpolator): android.view.animation.Interpolator;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
protected _play(): void;
|
|
22
|
+
protected _onAndroidAnimationEnd(): void;
|
|
23
|
+
protected _onAndroidAnimationCancel(): void;
|
|
24
|
+
protected _createAnimators(propertyAnimation: PropertyAnimation): void;
|
|
24
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Requires
|
|
2
|
-
import { AnimationBase,
|
|
2
|
+
import { AnimationBase, CubicBezierAnimationCurve } from './animation-common';
|
|
3
3
|
import { Color } from '../../color';
|
|
4
4
|
import { Trace } from '../../trace';
|
|
5
5
|
import { opacityProperty, backgroundColorProperty, rotateProperty, rotateXProperty, rotateYProperty, translateXProperty, translateYProperty, scaleXProperty, scaleYProperty, heightProperty, widthProperty, PercentLength } from '../styling/style-properties';
|
|
@@ -169,6 +169,8 @@ export class Animation extends AnimationBase {
|
|
|
169
169
|
this._animatorSet.addListener(this._animatorListener);
|
|
170
170
|
}
|
|
171
171
|
if (this._animators.length > 0) {
|
|
172
|
+
// TODO: fix sequentially which wont work because all animators values are computed before
|
|
173
|
+
// the first one starts...
|
|
172
174
|
if (this._playSequentially) {
|
|
173
175
|
this._animatorSet.playSequentially(this._nativeAnimatorsArray);
|
|
174
176
|
}
|
|
@@ -183,7 +185,6 @@ export class Animation extends AnimationBase {
|
|
|
183
185
|
this._animatorSet.start();
|
|
184
186
|
}
|
|
185
187
|
_onAndroidAnimationEnd() {
|
|
186
|
-
// tslint:disable-line
|
|
187
188
|
if (!this.isPlaying) {
|
|
188
189
|
// It has been cancelled
|
|
189
190
|
return;
|
|
@@ -195,7 +196,6 @@ export class Animation extends AnimationBase {
|
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
198
|
_onAndroidAnimationCancel() {
|
|
198
|
-
// tslint:disable-line
|
|
199
199
|
this._propertyResetCallbacks.forEach((v) => v());
|
|
200
200
|
this._rejectAnimationFinishedPromise();
|
|
201
201
|
if (this._target) {
|
|
@@ -210,13 +210,13 @@ export class Animation extends AnimationBase {
|
|
|
210
210
|
Trace.write('Creating ObjectAnimator(s) for animation: ' + Animation._getAnimationInfo(propertyAnimation) + '...', Trace.categories.Animation);
|
|
211
211
|
}
|
|
212
212
|
if (propertyAnimation.target === null || propertyAnimation.target === undefined) {
|
|
213
|
-
throw new Error(`Animation target cannot be null or undefined; property: ${propertyAnimation.
|
|
213
|
+
throw new Error(`Animation target cannot be null or undefined; property: ${propertyAnimation.propertyName}; value: ${propertyAnimation.value};`);
|
|
214
214
|
}
|
|
215
|
-
if (propertyAnimation.
|
|
215
|
+
if (propertyAnimation.propertyName === null || propertyAnimation.propertyName === undefined) {
|
|
216
216
|
throw new Error(`Animation property cannot be null or undefined; target: ${propertyAnimation.target}; value: ${propertyAnimation.value};`);
|
|
217
217
|
}
|
|
218
218
|
if (propertyAnimation.value === null || propertyAnimation.value === undefined) {
|
|
219
|
-
throw new Error(`Animation value cannot be null or undefined; target: ${propertyAnimation.target}; property: ${propertyAnimation.
|
|
219
|
+
throw new Error(`Animation value cannot be null or undefined; target: ${propertyAnimation.target}; property: ${propertyAnimation.propertyName};`);
|
|
220
220
|
}
|
|
221
221
|
this._target = propertyAnimation.target;
|
|
222
222
|
const nativeView = propertyAnimation.target.nativeViewProtected;
|
|
@@ -229,8 +229,9 @@ export class Animation extends AnimationBase {
|
|
|
229
229
|
const density = layout.getDisplayDensity();
|
|
230
230
|
const setLocal = this._valueSource === 'animation';
|
|
231
231
|
const style = propertyAnimation.target.style;
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
const propName = propertyAnimation.propertyName;
|
|
233
|
+
switch (propName) {
|
|
234
|
+
case 'opacity':
|
|
234
235
|
opacityProperty._initDefaultNativeValue(style);
|
|
235
236
|
originalValue1 = nativeView.getAlpha();
|
|
236
237
|
propertyUpdateCallbacks.push(() => {
|
|
@@ -249,7 +250,7 @@ export class Animation extends AnimationBase {
|
|
|
249
250
|
});
|
|
250
251
|
animators.push(createObjectAnimator(nativeView, 'alpha', propertyAnimation.value));
|
|
251
252
|
break;
|
|
252
|
-
case
|
|
253
|
+
case 'backgroundColor': {
|
|
253
254
|
backgroundColorProperty._initDefaultNativeValue(style);
|
|
254
255
|
ensureArgbEvaluator();
|
|
255
256
|
originalValue1 = propertyAnimation.target.backgroundColor;
|
|
@@ -280,7 +281,7 @@ export class Animation extends AnimationBase {
|
|
|
280
281
|
animators.push(animator);
|
|
281
282
|
break;
|
|
282
283
|
}
|
|
283
|
-
case
|
|
284
|
+
case 'translate':
|
|
284
285
|
translateXProperty._initDefaultNativeValue(style);
|
|
285
286
|
translateYProperty._initDefaultNativeValue(style);
|
|
286
287
|
originalValue1 = nativeView.getTranslationX() / density;
|
|
@@ -305,7 +306,7 @@ export class Animation extends AnimationBase {
|
|
|
305
306
|
});
|
|
306
307
|
animators.push(createAnimationSet([createObjectAnimator(nativeView, 'translationX', propertyAnimation.value.x * density), createObjectAnimator(nativeView, 'translationY', propertyAnimation.value.y * density)], propertyAnimation.iterations));
|
|
307
308
|
break;
|
|
308
|
-
case
|
|
309
|
+
case 'scale':
|
|
309
310
|
scaleXProperty._initDefaultNativeValue(style);
|
|
310
311
|
scaleYProperty._initDefaultNativeValue(style);
|
|
311
312
|
originalValue1 = nativeView.getScaleX();
|
|
@@ -330,7 +331,7 @@ export class Animation extends AnimationBase {
|
|
|
330
331
|
});
|
|
331
332
|
animators.push(createAnimationSet([createObjectAnimator(nativeView, 'scaleX', propertyAnimation.value.x), createObjectAnimator(nativeView, 'scaleY', propertyAnimation.value.y)], propertyAnimation.iterations));
|
|
332
333
|
break;
|
|
333
|
-
case
|
|
334
|
+
case 'rotate':
|
|
334
335
|
rotateProperty._initDefaultNativeValue(style);
|
|
335
336
|
rotateXProperty._initDefaultNativeValue(style);
|
|
336
337
|
rotateYProperty._initDefaultNativeValue(style);
|
|
@@ -361,29 +362,51 @@ export class Animation extends AnimationBase {
|
|
|
361
362
|
});
|
|
362
363
|
animators.push(createAnimationSet([createObjectAnimator(nativeView, 'rotationX', propertyAnimation.value.x), createObjectAnimator(nativeView, 'rotationY', propertyAnimation.value.y), createObjectAnimator(nativeView, 'rotation', propertyAnimation.value.z)], propertyAnimation.iterations));
|
|
363
364
|
break;
|
|
364
|
-
case
|
|
365
|
-
case
|
|
366
|
-
const isVertical = propertyAnimation.
|
|
365
|
+
case 'width':
|
|
366
|
+
case 'height': {
|
|
367
|
+
const isVertical = propertyAnimation.propertyName === 'height';
|
|
367
368
|
const extentProperty = isVertical ? heightProperty : widthProperty;
|
|
368
369
|
extentProperty._initDefaultNativeValue(style);
|
|
369
370
|
const nativeArray = Array.create('float', 2);
|
|
370
371
|
let toValue = propertyAnimation.value;
|
|
371
372
|
const parent = propertyAnimation.target.parent;
|
|
372
373
|
if (!parent) {
|
|
373
|
-
throw new Error(`cannot animate ${propertyAnimation.
|
|
374
|
+
throw new Error(`cannot animate ${propertyAnimation.propertyName} on root view`);
|
|
374
375
|
}
|
|
375
376
|
const parentExtent = isVertical ? parent.getMeasuredHeight() : parent.getMeasuredWidth();
|
|
376
|
-
|
|
377
|
+
const scale = Screen.mainScreen.scale;
|
|
378
|
+
if (toValue === 'auto') {
|
|
379
|
+
const target = propertyAnimation.target;
|
|
380
|
+
let widthSpec = target._currentWidthMeasureSpec;
|
|
381
|
+
let heightSpec = target._currentHeightMeasureSpec;
|
|
382
|
+
//we need to measure ourselves
|
|
383
|
+
if (propName === 'width') {
|
|
384
|
+
widthSpec = layout.makeMeasureSpec(0, layout.UNSPECIFIED);
|
|
385
|
+
target.measure(widthSpec, heightSpec);
|
|
386
|
+
toValue = target.getMeasuredWidth() / scale;
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
heightSpec = layout.makeMeasureSpec(0, layout.UNSPECIFIED);
|
|
390
|
+
target.measure(widthSpec, heightSpec);
|
|
391
|
+
toValue = target.getMeasuredHeight() / scale;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
toValue = PercentLength.toDevicePixels(toValue, parentExtent, parentExtent) / scale;
|
|
396
|
+
}
|
|
377
397
|
const nativeHeight = isVertical ? nativeView.getHeight() : nativeView.getWidth();
|
|
378
398
|
const targetStyle = setLocal ? extentProperty.name : extentProperty.keyframe;
|
|
379
|
-
originalValue1 = nativeHeight /
|
|
399
|
+
originalValue1 = nativeHeight / scale;
|
|
380
400
|
nativeArray[0] = originalValue1;
|
|
381
401
|
nativeArray[1] = toValue;
|
|
382
402
|
const extentAnimator = android.animation.ValueAnimator.ofFloat(nativeArray);
|
|
383
403
|
extentAnimator.addUpdateListener(new android.animation.ValueAnimator.AnimatorUpdateListener({
|
|
384
404
|
onAnimationUpdate(animator) {
|
|
385
|
-
|
|
386
|
-
|
|
405
|
+
let result = animator.getAnimatedValue();
|
|
406
|
+
if (result instanceof java.lang.Number) {
|
|
407
|
+
result = result.floatValue();
|
|
408
|
+
}
|
|
409
|
+
propertyAnimation.target.style[setLocal ? extentProperty.name : extentProperty.keyframe] = result;
|
|
387
410
|
},
|
|
388
411
|
}));
|
|
389
412
|
propertyUpdateCallbacks.push(() => {
|
|
@@ -393,14 +416,68 @@ export class Animation extends AnimationBase {
|
|
|
393
416
|
propertyAnimation.target.style[targetStyle] = originalValue1;
|
|
394
417
|
if (propertyAnimation.target.nativeViewProtected) {
|
|
395
418
|
const setter = propertyAnimation.target[extentProperty.setNative];
|
|
396
|
-
setter(propertyAnimation.target.style[propertyAnimation.
|
|
419
|
+
setter.call(propertyAnimation.target, propertyAnimation.target.style[propertyAnimation.propertyName]);
|
|
397
420
|
}
|
|
398
421
|
});
|
|
399
422
|
animators.push(extentAnimator);
|
|
400
423
|
break;
|
|
401
424
|
}
|
|
402
425
|
default:
|
|
403
|
-
|
|
426
|
+
if (propertyAnimation.property) {
|
|
427
|
+
const property = propertyAnimation.property;
|
|
428
|
+
if (property._initDefaultNativeValue) {
|
|
429
|
+
property._initDefaultNativeValue(style);
|
|
430
|
+
}
|
|
431
|
+
originalValue1 = propertyAnimation.target[propertyAnimation.propertyName];
|
|
432
|
+
let nativeArray;
|
|
433
|
+
if (propertyAnimation.value instanceof Color) {
|
|
434
|
+
ensureArgbEvaluator();
|
|
435
|
+
nativeArray = Array.create(java.lang.Object, 2);
|
|
436
|
+
nativeArray[0] = java.lang.Integer.valueOf(originalValue1.android);
|
|
437
|
+
nativeArray[1] = java.lang.Integer.valueOf(propertyAnimation.value.android);
|
|
438
|
+
const animator = android.animation.ValueAnimator.ofObject(argbEvaluator, nativeArray);
|
|
439
|
+
animator.addUpdateListener(new android.animation.ValueAnimator.AnimatorUpdateListener({
|
|
440
|
+
onAnimationUpdate(animator) {
|
|
441
|
+
const argb = animator.getAnimatedValue().intValue();
|
|
442
|
+
propertyAnimation.target.style[setLocal ? property.name : property.keyframe] = new Color(argb);
|
|
443
|
+
},
|
|
444
|
+
}));
|
|
445
|
+
animators.push(animator);
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
nativeArray = Array.create('float', 2);
|
|
449
|
+
nativeArray[0] = originalValue1;
|
|
450
|
+
nativeArray[1] = propertyAnimation.value;
|
|
451
|
+
const animator = android.animation.ValueAnimator.ofFloat(nativeArray);
|
|
452
|
+
animator.addUpdateListener(new android.animation.ValueAnimator.AnimatorUpdateListener({
|
|
453
|
+
onAnimationUpdate(animator) {
|
|
454
|
+
let result = animator.getAnimatedValue();
|
|
455
|
+
if (result instanceof java.lang.Number) {
|
|
456
|
+
result = result.floatValue();
|
|
457
|
+
}
|
|
458
|
+
propertyAnimation.target.style[setLocal ? property.name : property.keyframe] = result;
|
|
459
|
+
},
|
|
460
|
+
}));
|
|
461
|
+
animators.push(animator);
|
|
462
|
+
}
|
|
463
|
+
propertyUpdateCallbacks.push(() => {
|
|
464
|
+
propertyAnimation.target.style[setLocal ? property.name : property.keyframe] = propertyAnimation.value;
|
|
465
|
+
});
|
|
466
|
+
propertyResetCallbacks.push(() => {
|
|
467
|
+
if (setLocal) {
|
|
468
|
+
propertyAnimation.target.style[property.name] = originalValue1;
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
propertyAnimation.target.style[property.keyframe] = originalValue1;
|
|
472
|
+
}
|
|
473
|
+
if (propertyAnimation.target.nativeViewProtected && propertyAnimation.target[property.setNative]) {
|
|
474
|
+
propertyAnimation.target[property.setNative](propertyAnimation.target.style[propertyAnimation.propertyName]);
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
throw new Error(`Animating property '${propertyAnimation.propertyName}' is unsupported`);
|
|
480
|
+
}
|
|
404
481
|
}
|
|
405
482
|
for (let i = 0, length = animators.length; i < length; i++) {
|
|
406
483
|
// Duration
|