@maccesar/titools 2.2.4 → 2.2.8
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/README.md +23 -23
- package/lib/commands/update.js +4 -12
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +31 -31
- package/skills/alloy-guides/references/CONCEPTS.md +3 -3
- package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/MODELS.md +6 -6
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
- package/skills/alloy-guides/references/WIDGETS.md +1 -1
- package/skills/alloy-howtos/SKILL.md +27 -27
- package/skills/alloy-howtos/references/best_practices.md +9 -9
- package/skills/alloy-howtos/references/cli_reference.md +14 -14
- package/skills/alloy-howtos/references/config_files.md +16 -16
- package/skills/alloy-howtos/references/custom_tags.md +16 -16
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
- package/skills/alloy-howtos/references/samples.md +19 -19
- package/skills/purgetss/SKILL.md +11 -1
- package/skills/purgetss/references/animation-system.md +1 -1
- package/skills/purgetss/references/cli-commands.md +3 -3
- package/skills/purgetss/references/customization-deep-dive.md +1 -1
- package/skills/purgetss/references/dynamic-component-creation.md +1 -1
- package/skills/purgetss/references/icon-fonts.md +4 -0
- package/skills/purgetss/references/installation-setup.md +8 -1
- package/skills/purgetss/references/migration-guide.md +4 -0
- package/skills/purgetss/references/tikit-components.md +193 -204
- package/skills/purgetss/references/ui-ux-design.md +1 -1
- package/skills/ti-expert/SKILL.md +78 -118
- package/skills/ti-expert/references/alloy-builtins.md +18 -18
- package/skills/ti-expert/references/alloy-structure.md +21 -21
- package/skills/ti-expert/references/anti-patterns.md +15 -15
- package/skills/ti-expert/references/cli-expert.md +15 -15
- package/skills/ti-expert/references/code-conventions.md +38 -38
- package/skills/ti-expert/references/contracts.md +8 -8
- package/skills/ti-expert/references/controller-patterns.md +14 -14
- package/skills/ti-expert/references/error-handling.md +11 -11
- package/skills/ti-expert/references/examples.md +12 -12
- package/skills/ti-expert/references/migration-patterns.md +24 -24
- package/skills/ti-expert/references/patterns.md +10 -10
- package/skills/ti-expert/references/performance-listview.md +16 -16
- package/skills/ti-expert/references/performance-optimization.md +41 -41
- package/skills/ti-expert/references/security-device.md +22 -22
- package/skills/ti-expert/references/security-fundamentals.md +19 -19
- package/skills/ti-expert/references/state-management.md +33 -33
- package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
- package/skills/ti-expert/references/testing-unit.md +24 -24
- package/skills/ti-expert/references/theming.md +15 -15
- package/skills/ti-guides/SKILL.md +58 -60
- package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
- package/skills/ti-guides/references/android-manifest.md +15 -15
- package/skills/ti-guides/references/app-distribution.md +70 -166
- package/skills/ti-guides/references/application-frameworks.md +96 -114
- package/skills/ti-guides/references/cli-reference.md +294 -294
- package/skills/ti-guides/references/coding-best-practices.md +42 -33
- package/skills/ti-guides/references/commonjs-advanced.md +57 -51
- package/skills/ti-guides/references/hello-world.md +36 -36
- package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
- package/skills/ti-guides/references/javascript-primer.md +83 -101
- package/skills/ti-guides/references/reserved-words.md +9 -9
- package/skills/ti-guides/references/resources.md +75 -83
- package/skills/ti-guides/references/style-and-conventions.md +35 -28
- package/skills/ti-guides/references/tiapp-config.md +110 -74
- package/skills/ti-howtos/SKILL.md +88 -92
- package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
- package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
- package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
- package/skills/ti-howtos/references/cross-platform-development.md +115 -136
- package/skills/ti-howtos/references/debugging-profiling.md +167 -181
- package/skills/ti-howtos/references/extending-titanium.md +121 -121
- package/skills/ti-howtos/references/google-maps-v2.md +84 -82
- package/skills/ti-howtos/references/ios-map-kit.md +65 -60
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
- package/skills/ti-howtos/references/local-data-sources.md +79 -78
- package/skills/ti-howtos/references/location-and-maps.md +116 -120
- package/skills/ti-howtos/references/media-apis.md +87 -86
- package/skills/ti-howtos/references/notification-services.md +250 -260
- package/skills/ti-howtos/references/remote-data-sources.md +98 -93
- package/skills/ti-howtos/references/tutorials.md +226 -216
- package/skills/ti-howtos/references/using-modules.md +73 -102
- package/skills/ti-howtos/references/web-content-integration.md +101 -103
- package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
- package/skills/ti-ui/SKILL.md +85 -85
- package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
- package/skills/ti-ui/references/animation-and-matrices.md +79 -79
- package/skills/ti-ui/references/application-structures.md +96 -99
- package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
- package/skills/ti-ui/references/event-handling.md +58 -58
- package/skills/ti-ui/references/gestures.md +62 -64
- package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
- package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
- package/skills/ti-ui/references/listviews-and-performance.md +107 -107
- package/skills/ti-ui/references/orientation.md +87 -88
- package/skills/ti-ui/references/platform-ui-android.md +87 -81
- package/skills/ti-ui/references/platform-ui-ios.md +63 -61
- package/skills/ti-ui/references/scrolling-views.md +29 -29
- package/skills/ti-ui/references/tableviews.md +56 -56
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# Animation,
|
|
1
|
+
# Animation, matrices, and transitions
|
|
2
2
|
|
|
3
3
|
## 1. Overview
|
|
4
4
|
|
|
5
|
-
Animations
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
5
|
+
Animations make state changes easier to read and can help an interface feel responsive. Use them with restraint. Titanium includes:
|
|
6
|
+
- Basic property animations (opacity, position, color, etc.)
|
|
7
|
+
- 2D matrix transforms (scale, rotate, translate) for iOS and Android
|
|
8
|
+
- 3D matrix transforms (x, y, z space) for iOS only
|
|
9
|
+
- iOS transitions (flip, curl, etc.)
|
|
10
|
+
- Dynamic, physics-based animations for iOS only
|
|
11
11
|
|
|
12
|
-
## 2. Basic
|
|
12
|
+
## 2. Basic animations
|
|
13
13
|
|
|
14
|
-
### Property
|
|
14
|
+
### Property animation syntax
|
|
15
15
|
|
|
16
16
|
```javascript
|
|
17
17
|
// Method 1: Direct object
|
|
@@ -41,7 +41,7 @@ view.animate({
|
|
|
41
41
|
});
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
### Animation
|
|
44
|
+
### Animation properties
|
|
45
45
|
|
|
46
46
|
| Property | Description | Default |
|
|
47
47
|
| -------------------------------- | ------------------------- | ----------------------------------- |
|
|
@@ -58,7 +58,7 @@ view.animate({
|
|
|
58
58
|
| `view` | View for transition | - |
|
|
59
59
|
| `transition` | Transition type (iOS) | - |
|
|
60
60
|
|
|
61
|
-
### Animation
|
|
61
|
+
### Animation curves (easing)
|
|
62
62
|
|
|
63
63
|
```javascript
|
|
64
64
|
// Available curves
|
|
@@ -76,7 +76,7 @@ view.animate({
|
|
|
76
76
|
});
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
### Reversing
|
|
79
|
+
### Reversing animation
|
|
80
80
|
|
|
81
81
|
```javascript
|
|
82
82
|
// Use autoreverse for simple reversal
|
|
@@ -98,7 +98,7 @@ view.animate({
|
|
|
98
98
|
});
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
### Repeating
|
|
101
|
+
### Repeating animation
|
|
102
102
|
|
|
103
103
|
```javascript
|
|
104
104
|
// Repeat 3 times
|
|
@@ -120,19 +120,19 @@ view.animate({
|
|
|
120
120
|
view.animate({ opacity: view.opacity, duration: 0 });
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
## 3. 2D
|
|
123
|
+
## 3. 2D matrix animations
|
|
124
124
|
|
|
125
|
-
2D matrices work on both iOS and Android.
|
|
125
|
+
2D matrices work on both iOS and Android. They transform the x and y plane with scale, rotate, translate, and skew.
|
|
126
126
|
|
|
127
|
-
### Basic 2D
|
|
127
|
+
### Basic 2D transform
|
|
128
128
|
|
|
129
129
|
```javascript
|
|
130
130
|
// Create matrix
|
|
131
131
|
let matrix2d = Ti.UI.create2DMatrix();
|
|
132
132
|
|
|
133
133
|
// Apply transformations
|
|
134
|
-
matrix2d = matrix2d.rotate(20);
|
|
135
|
-
matrix2d = matrix2d.scale(1.5);
|
|
134
|
+
matrix2d = matrix2d.rotate(20); // Rotate 20 degrees
|
|
135
|
+
matrix2d = matrix2d.scale(1.5); // Scale 1.5x
|
|
136
136
|
matrix2d = matrix2d.translate(50, 50); // Move 50px right, 50px down
|
|
137
137
|
|
|
138
138
|
// Apply animation
|
|
@@ -144,21 +144,21 @@ view.animate({
|
|
|
144
144
|
});
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
### 2D
|
|
147
|
+
### 2D matrix methods
|
|
148
148
|
|
|
149
149
|
| Method | Description |
|
|
150
150
|
| ------------------- | ------------------------- |
|
|
151
151
|
| `rotate(degrees)` | Rotate clockwise |
|
|
152
152
|
| `scale(sx, sy)` | Scale (sy defaults to sx) |
|
|
153
153
|
| `translate(dx, dy)` | Move by delta |
|
|
154
|
-
| `skew(x, y)` | Skew
|
|
154
|
+
| `skew(x, y)` | Skew or shear |
|
|
155
155
|
| `invert()` | Invert matrix |
|
|
156
156
|
| `multiply(matrix)` | Multiply matrices |
|
|
157
157
|
| `length` | Get matrix length |
|
|
158
158
|
|
|
159
|
-
### Sequential
|
|
159
|
+
### Sequential transformations
|
|
160
160
|
|
|
161
|
-
Order matters
|
|
161
|
+
Order matters.
|
|
162
162
|
|
|
163
163
|
```javascript
|
|
164
164
|
// Rotate THEN scale
|
|
@@ -172,7 +172,7 @@ const matrix2 = Ti.UI.create2DMatrix()
|
|
|
172
172
|
.rotate(45);
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
### Identity (
|
|
175
|
+
### Identity (reset) transform
|
|
176
176
|
|
|
177
177
|
```javascript
|
|
178
178
|
// Reset to original state
|
|
@@ -183,17 +183,17 @@ view.animate({
|
|
|
183
183
|
});
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
## 4. 3D
|
|
186
|
+
## 4. 3D matrix animations (iOS only)
|
|
187
187
|
|
|
188
|
-
3D matrices work in x
|
|
188
|
+
3D matrices work in x, y, and z space on iOS only.
|
|
189
189
|
|
|
190
|
-
### Basic 3D
|
|
190
|
+
### Basic 3D transform
|
|
191
191
|
|
|
192
192
|
```javascript
|
|
193
193
|
let matrix3d = Ti.UI.create3DMatrix();
|
|
194
194
|
|
|
195
195
|
// Rotate around axis vector (x, y, z)
|
|
196
|
-
matrix3d = matrix3d.rotate(180, 1, 1, 0); // 180
|
|
196
|
+
matrix3d = matrix3d.rotate(180, 1, 1, 0); // 180 degrees around diagonal
|
|
197
197
|
|
|
198
198
|
// Scale in 3 dimensions
|
|
199
199
|
matrix3d = matrix3d.scale(2, 2, 2);
|
|
@@ -206,18 +206,18 @@ view.animate({
|
|
|
206
206
|
});
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
### 3D
|
|
209
|
+
### 3D matrix methods
|
|
210
210
|
|
|
211
|
-
| Method | Description
|
|
212
|
-
| -------------------------- |
|
|
213
|
-
| `rotate(degrees, x, y, z)` | Rotate around vector
|
|
214
|
-
| `scale(sx, sy, sz)` | Scale in 3D
|
|
215
|
-
| `translate(dx, dy, dz)` | Move in 3D
|
|
216
|
-
| `invert()` | Invert matrix
|
|
217
|
-
| `multiply(matrix)` | Multiply matrices
|
|
218
|
-
| `perspective(p)` | Set perspective
|
|
211
|
+
| Method | Description |
|
|
212
|
+
| -------------------------- | -------------------- |
|
|
213
|
+
| `rotate(degrees, x, y, z)` | Rotate around vector |
|
|
214
|
+
| `scale(sx, sy, sz)` | Scale in 3D |
|
|
215
|
+
| `translate(dx, dy, dz)` | Move in 3D |
|
|
216
|
+
| `invert()` | Invert matrix |
|
|
217
|
+
| `multiply(matrix)` | Multiply matrices |
|
|
218
|
+
| `perspective(p)` | Set perspective |
|
|
219
219
|
|
|
220
|
-
### Flip
|
|
220
|
+
### Flip card effect
|
|
221
221
|
|
|
222
222
|
```javascript
|
|
223
223
|
const frontView = Ti.UI.createView({
|
|
@@ -252,11 +252,11 @@ frontView.addEventListener('click', () => {
|
|
|
252
252
|
});
|
|
253
253
|
```
|
|
254
254
|
|
|
255
|
-
## 5. iOS
|
|
255
|
+
## 5. iOS transitions
|
|
256
256
|
|
|
257
|
-
Transitions are built-in animations for switching between
|
|
257
|
+
Transitions are built-in animations for switching between views and windows.
|
|
258
258
|
|
|
259
|
-
### Transition
|
|
259
|
+
### Transition constants
|
|
260
260
|
|
|
261
261
|
```javascript
|
|
262
262
|
Ti.UI.iPhone.AnimationStyle.CURL_UP
|
|
@@ -267,7 +267,7 @@ Ti.UI.iPhone.AnimationStyle.NONE
|
|
|
267
267
|
Ti.UI.iPhone.AnimationStyle.OPAQUE_FADE // Fade with black (not transparent)
|
|
268
268
|
```
|
|
269
269
|
|
|
270
|
-
### View
|
|
270
|
+
### View transition
|
|
271
271
|
|
|
272
272
|
```javascript
|
|
273
273
|
const container = Ti.UI.createView({ width: 300, height: 300 });
|
|
@@ -293,7 +293,7 @@ container.addEventListener('click', () => {
|
|
|
293
293
|
});
|
|
294
294
|
```
|
|
295
295
|
|
|
296
|
-
### Window
|
|
296
|
+
### Window transition (NavigationWindow)
|
|
297
297
|
|
|
298
298
|
```javascript
|
|
299
299
|
const navWindow = Ti.UI.createNavigationWindow({
|
|
@@ -318,11 +318,11 @@ const win1 = Ti.UI.createWindow({
|
|
|
318
318
|
navWindow.openWindow(win1);
|
|
319
319
|
```
|
|
320
320
|
|
|
321
|
-
## 6. Dynamic
|
|
321
|
+
## 6. Dynamic animations (iOS only)
|
|
322
322
|
|
|
323
|
-
Physics-based animations
|
|
323
|
+
Physics-based animations use `Ti.UI.iOS.Animator`.
|
|
324
324
|
|
|
325
|
-
### Gravity
|
|
325
|
+
### Gravity animation
|
|
326
326
|
|
|
327
327
|
```javascript
|
|
328
328
|
const animator = Ti.UI.iOS.createAnimator({
|
|
@@ -349,7 +349,7 @@ animator.addBehavior(collision);
|
|
|
349
349
|
animator.startAnimator();
|
|
350
350
|
```
|
|
351
351
|
|
|
352
|
-
### Attachment (
|
|
352
|
+
### Attachment (spring) behavior
|
|
353
353
|
|
|
354
354
|
```javascript
|
|
355
355
|
const attachment = Ti.UI.iOS.createAttachmentBehavior({
|
|
@@ -364,7 +364,7 @@ animator.addBehavior(attachment);
|
|
|
364
364
|
animator.startAnimator();
|
|
365
365
|
```
|
|
366
366
|
|
|
367
|
-
### Push
|
|
367
|
+
### Push behavior
|
|
368
368
|
|
|
369
369
|
```javascript
|
|
370
370
|
const push = Ti.UI.iOS.createPushBehavior({
|
|
@@ -377,9 +377,9 @@ push.addItem(viewToPush);
|
|
|
377
377
|
animator.addBehavior(push);
|
|
378
378
|
```
|
|
379
379
|
|
|
380
|
-
## 7. Animation
|
|
380
|
+
## 7. Animation events
|
|
381
381
|
|
|
382
|
-
### Animation
|
|
382
|
+
### Animation lifecycle
|
|
383
383
|
|
|
384
384
|
```javascript
|
|
385
385
|
const animation = Ti.UI.createAnimation({
|
|
@@ -400,7 +400,7 @@ animation.addEventListener('complete', (e) => {
|
|
|
400
400
|
view.animate(animation);
|
|
401
401
|
```
|
|
402
402
|
|
|
403
|
-
### Stopping
|
|
403
|
+
### Stopping animations
|
|
404
404
|
|
|
405
405
|
```javascript
|
|
406
406
|
// Method 1: Overwrite with new animation (duration: 0)
|
|
@@ -417,9 +417,9 @@ parent.remove(view);
|
|
|
417
417
|
view.visible = false;
|
|
418
418
|
```
|
|
419
419
|
|
|
420
|
-
## 8. Common
|
|
420
|
+
## 8. Common animation patterns
|
|
421
421
|
|
|
422
|
-
### Fade
|
|
422
|
+
### Fade in and out
|
|
423
423
|
|
|
424
424
|
```javascript
|
|
425
425
|
function fadeIn(view, duration, callback) {
|
|
@@ -435,7 +435,7 @@ function fadeOut(view, duration, callback) {
|
|
|
435
435
|
}
|
|
436
436
|
```
|
|
437
437
|
|
|
438
|
-
### Slide
|
|
438
|
+
### Slide in
|
|
439
439
|
|
|
440
440
|
```javascript
|
|
441
441
|
function slideInFromRight(view, duration) {
|
|
@@ -448,7 +448,7 @@ function slideInFromRight(view, duration) {
|
|
|
448
448
|
}
|
|
449
449
|
```
|
|
450
450
|
|
|
451
|
-
### Pulse
|
|
451
|
+
### Pulse animation
|
|
452
452
|
|
|
453
453
|
```javascript
|
|
454
454
|
function pulse(view) {
|
|
@@ -464,7 +464,7 @@ function pulse(view) {
|
|
|
464
464
|
}
|
|
465
465
|
```
|
|
466
466
|
|
|
467
|
-
### Shake
|
|
467
|
+
### Shake animation
|
|
468
468
|
|
|
469
469
|
```javascript
|
|
470
470
|
function shake(view) {
|
|
@@ -478,7 +478,7 @@ function shake(view) {
|
|
|
478
478
|
}
|
|
479
479
|
```
|
|
480
480
|
|
|
481
|
-
### Bounce
|
|
481
|
+
### Bounce in
|
|
482
482
|
|
|
483
483
|
```javascript
|
|
484
484
|
function bounceIn(view) {
|
|
@@ -497,22 +497,22 @@ function bounceIn(view) {
|
|
|
497
497
|
}
|
|
498
498
|
```
|
|
499
499
|
|
|
500
|
-
## 9. Performance
|
|
500
|
+
## 9. Performance considerations
|
|
501
501
|
|
|
502
|
-
|
|
503
|
-
- Use hardware-accelerated properties (opacity, transform)
|
|
504
|
-
- Animate `transform` instead of `top
|
|
505
|
-
- Use `autoreverse` for simple back-and-forth
|
|
506
|
-
- Cache animation objects for reuse
|
|
507
|
-
- Stop unused animations
|
|
502
|
+
Do:
|
|
503
|
+
- Use hardware-accelerated properties (opacity, transform).
|
|
504
|
+
- Animate `transform` instead of `top` or `left` when possible.
|
|
505
|
+
- Use `autoreverse` for simple back-and-forth.
|
|
506
|
+
- Cache animation objects for reuse.
|
|
507
|
+
- Stop unused animations.
|
|
508
508
|
|
|
509
|
-
|
|
510
|
-
- Animate `width
|
|
511
|
-
- Animate too many views
|
|
512
|
-
- Use JavaScript loops for animation
|
|
513
|
-
- Animate properties that trigger reflow
|
|
509
|
+
Don't:
|
|
510
|
+
- Animate `width` or `height` since it triggers layout recalculation.
|
|
511
|
+
- Animate too many views at once.
|
|
512
|
+
- Use JavaScript loops for animation.
|
|
513
|
+
- Animate properties that trigger reflow.
|
|
514
514
|
|
|
515
|
-
### Bad vs
|
|
515
|
+
### Bad vs good
|
|
516
516
|
|
|
517
517
|
```javascript
|
|
518
518
|
// BAD - Triggers layout
|
|
@@ -529,24 +529,24 @@ view.animate({
|
|
|
529
529
|
});
|
|
530
530
|
```
|
|
531
531
|
|
|
532
|
-
## 10. Platform
|
|
532
|
+
## 10. Platform differences
|
|
533
533
|
|
|
534
534
|
### iOS vs Android
|
|
535
535
|
|
|
536
536
|
| Feature | iOS | Android |
|
|
537
537
|
| ------------------ | ------------ | ----------------- |
|
|
538
|
-
| 2D
|
|
539
|
-
| 3D
|
|
538
|
+
| 2D matrix | Full support | Full support |
|
|
539
|
+
| 3D matrix | Full support | Not supported |
|
|
540
540
|
| Transitions | Full support | Not supported |
|
|
541
541
|
| Dynamic animations | Full support | Not supported |
|
|
542
542
|
| Curves | +SPRING | Basic curves only |
|
|
543
543
|
| Color animation | RGBA full | Basic colors |
|
|
544
544
|
|
|
545
|
-
## Best
|
|
545
|
+
## Best practices
|
|
546
546
|
|
|
547
|
-
1.
|
|
548
|
-
2.
|
|
549
|
-
3.
|
|
550
|
-
4.
|
|
551
|
-
5.
|
|
552
|
-
6.
|
|
547
|
+
1. Keep animations simple. The more complex they get, the harder they are to debug.
|
|
548
|
+
2. Test on devices. Simulator performance is not the same.
|
|
549
|
+
3. Consider accessibility. Respect the `reduceMotion` setting.
|
|
550
|
+
4. Use sensible duration. 200 to 300 ms for subtle motion, about 500 ms for noticeable.
|
|
551
|
+
5. Avoid long animation chains. Prefer a callback instead of deep nesting.
|
|
552
|
+
6. Clean up. Remove event listeners on animation completion.
|