From 5265bf0ae3bed4255133fe148dad4f2c9d542d65 Mon Sep 17 00:00:00 2001 From: Panayot Cankov Date: Tue, 7 Feb 2017 09:11:58 +0200 Subject: [PATCH] Animation properties and some backward compatability with the QSF --- .../gallery-app/animations/css-keyframes.css | 58 +++++++++ .../gallery-app/animations/css-keyframes.ts | 13 ++ .../gallery-app/animations/css-keyframes.xml | 18 +++ .../{configurable.ts => js-configurable.ts} | 43 ++++++- .../{configurable.xml => js-configurable.xml} | 1 - .../{opacity.css => js-opacity.css} | 0 .../animations/{opacity.ts => js-opacity.ts} | 0 .../{opacity.xml => js-opacity.xml} | 0 apps/app/gallery-app/animations/model.ts | 37 ------ apps/app/gallery-app/main-page.xml | 5 +- .../ui/animation/animation.android.ts | 79 +++++++++--- .../ui/animation/animation.ios.ts | 72 +++++------ .../ui/animation/keyframe-animation.ts | 66 +++++++--- tns-core-modules/ui/core/properties.ts | 120 ++++++++++++++++-- tns-core-modules/ui/core/view-common.ts | 24 ++-- tns-core-modules/ui/core/view.android.ts | 12 +- tns-core-modules/ui/core/view.d.ts | 20 +-- tns-core-modules/ui/core/view.ios.ts | 14 +- tns-core-modules/ui/definitions.d.ts | 21 +++ tns-core-modules/ui/image/image-common.ts | 2 +- tns-core-modules/ui/image/image.ios.ts | 5 +- tns-core-modules/ui/styling/style-scope.ts | 4 +- tns-core-modules/ui/styling/style.d.ts | 4 +- 23 files changed, 446 insertions(+), 172 deletions(-) create mode 100644 apps/app/gallery-app/animations/css-keyframes.css create mode 100644 apps/app/gallery-app/animations/css-keyframes.ts create mode 100644 apps/app/gallery-app/animations/css-keyframes.xml rename apps/app/gallery-app/animations/{configurable.ts => js-configurable.ts} (82%) rename apps/app/gallery-app/animations/{configurable.xml => js-configurable.xml} (95%) rename apps/app/gallery-app/animations/{opacity.css => js-opacity.css} (100%) rename apps/app/gallery-app/animations/{opacity.ts => js-opacity.ts} (100%) rename apps/app/gallery-app/animations/{opacity.xml => js-opacity.xml} (100%) delete mode 100644 apps/app/gallery-app/animations/model.ts diff --git a/apps/app/gallery-app/animations/css-keyframes.css b/apps/app/gallery-app/animations/css-keyframes.css new file mode 100644 index 000000000..b22f8c3aa --- /dev/null +++ b/apps/app/gallery-app/animations/css-keyframes.css @@ -0,0 +1,58 @@ +@keyframes intro { + 0% { + opacity: 0; + transform: translate(-100, 0); + } + 100% { + opacity: 1; + transform: translate(0, 0); + } +} +@keyframes outro { + 0% { + opacity: 1; + transform: translate(0, 0); + } + 100% { + opacity: 0; + transform: translate(-100, 0); + } +} + +.intro { + animation-name: intro; + animation-duration: 3.0; + animation-fill-mode: forwards; + animation-iteration-count: 1; + animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1); +} +.outro { + animation-name: outro; + animation-duration: 3.0; + animation-fill-mode: forwards; + animation-iteration-count: 1; + animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1); +} + +.gone { + opacity: 0; + transform: translate(-100, 0); +} + +@keyframes play { + 0% { transform: translate(0, 0); } + 33% { transform: translate(100, 0); } + 66% { transform: translate(100, 100); } + 100% { transform: translate(0, 100); } +} + +.idle { + transform: translate(0, 0); +} +.play { + animation-name: play; + animation-duration: 3.0; + animation-fill-mode: forwards; + animation-iteration-count: 1; + animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1); +} diff --git a/apps/app/gallery-app/animations/css-keyframes.ts b/apps/app/gallery-app/animations/css-keyframes.ts new file mode 100644 index 000000000..1abd4d8ed --- /dev/null +++ b/apps/app/gallery-app/animations/css-keyframes.ts @@ -0,0 +1,13 @@ +import { View, EventData } from "ui/core/view"; + +export function setClass(args: EventData) { + const btn = (args.object); + const img = btn.page.getViewById("img"); + img.className = btn.tag; +} + +export function setImg2Class(args: EventData) { + const btn = (args.object); + const img2 = btn.page.getViewById("img2"); + img2.className = btn.tag; +} diff --git a/apps/app/gallery-app/animations/css-keyframes.xml b/apps/app/gallery-app/animations/css-keyframes.xml new file mode 100644 index 000000000..bfe152bb6 --- /dev/null +++ b/apps/app/gallery-app/animations/css-keyframes.xml @@ -0,0 +1,18 @@ + + +