MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / TouchAnimationsModel

Class TouchAnimationsModel

apps/toolbox/src/pages/touch-animations.ts:10–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8}
9
10export class TouchAnimationsModel extends Observable {
11 touchAnimation: TouchAnimationOptions = {
12 down: {
13 scale: { x: 0.95, y: 0.95 },
14 backgroundColor: new Color('purple'),
15 duration: 250,
16 curve: CoreTypes.AnimationCurve.easeInOut,
17 },
18 up: {
19 scale: { x: 1, y: 1 },
20 backgroundColor: new Color('#30bcff'),
21 duration: 250,
22 curve: CoreTypes.AnimationCurve.easeInOut,
23 },
24 };
25
26 touchAnimationLabel: TouchAnimationOptions = {
27 down: {
28 scale: { x: 0.85, y: 0.85 },
29 duration: 150,
30 curve: CoreTypes.AnimationCurve.easeInOut,
31 },
32 up: {
33 scale: { x: 1, y: 1 },
34 duration: 150,
35 curve: CoreTypes.AnimationCurve.easeInOut,
36 },
37 };
38
39 touchAnimationLayout: TouchAnimationOptions = {
40 down: {
41 scale: { x: 0.85, y: 0.85 },
42 opacity: 0.7,
43 duration: 250,
44 curve: CoreTypes.AnimationCurve.easeInOut,
45 },
46 up: {
47 scale: { x: 1, y: 1 },
48 opacity: 1,
49 duration: 250,
50 curve: CoreTypes.AnimationCurve.easeInOut,
51 },
52 };
53
54 touchAnimationNative: TouchAnimationOptions = {
55 down: (view: View) => {
56 const shakeIt = () => {
57 // shake when all the way down
58 view
59 .animate({ translate: { x: -20, y: 0 }, scale: { x: 0.95, y: 0.95 }, duration: 60, curve: CoreTypes.AnimationCurve.linear })
60 .then(function () {
61 return view.animate({ translate: { x: 20, y: 0 }, duration: 60, curve: CoreTypes.AnimationCurve.linear });
62 })
63 .then(function () {
64 return view.animate({ translate: { x: -20, y: 0 }, duration: 60, curve: CoreTypes.AnimationCurve.linear });
65 })
66 .then(function () {
67 return view.animate({ translate: { x: 20, y: 0 }, duration: 60, curve: CoreTypes.AnimationCurve.linear });

Callers

nothing calls this directly

Calls 1

animateMethod · 0.45

Tested by

no test coverage detected