chore: fix tslint errors

This commit is contained in:
Martin Yankov
2019-05-07 15:58:16 +03:00
parent 66d631ebca
commit a84b6301ed
11 changed files with 111 additions and 111 deletions

View File

@@ -1,16 +1,16 @@
import * as view from 'tns-core-modules/ui/core/view';
import {View} from 'tns-core-modules/ui/core/view';
import * as pages from 'tns-core-modules/ui/page';
import {Button} from 'tns-core-modules/ui/button';
import {SegmentedBar, SegmentedBarItem} from 'tns-core-modules/ui/segmented-bar';
import {Label} from 'tns-core-modules/ui/label';
import {Animation, AnimationDefinition} from 'tns-core-modules/ui/animation';
import * as fpsMeter from 'tns-core-modules/fps-meter';
import * as view from "tns-core-modules/ui/core/view";
import { View } from "tns-core-modules/ui/core/view";
import * as pages from "tns-core-modules/ui/page";
import { Button } from "tns-core-modules/ui/button";
import { SegmentedBar, SegmentedBarItem } from "tns-core-modules/ui/segmented-bar";
import { Label } from "tns-core-modules/ui/label";
import { Animation, AnimationDefinition } from "tns-core-modules/ui/animation";
import * as fpsMeter from "tns-core-modules/fps-meter";
let fpsCallbackId;
export function onLoaded(args) {
const page = args.object;
const fpsLabel = view.getViewById(page, 'fps') as Label;
const fpsLabel = view.getViewById(page, "fps") as Label;
fpsCallbackId = fpsMeter.addCallback((fps: number, minFps: number) => {
fpsLabel.text = `${fps.toFixed(2)}/${minFps.toFixed(2)}`;
});
@@ -30,47 +30,47 @@ export function getBoxPropertyAnimationData(property: string,
let animateKey;
let animateValueTo;
let animateValueFrom;
let animateDuration = animateEase === 'spring' ? 800 : 500;
let animateReturnDelay = animateEase === 'spring' ? 0 : 200;
let animateDuration = animateEase === "spring" ? 800 : 500;
let animateReturnDelay = animateEase === "spring" ? 0 : 200;
// Determine the full animation property name (some are shortened in UI), and the demo to/from values
switch (property) {
case 'height':
case "height":
target.originX = target.originY = 0.5;
animateKey = 'height';
animateKey = "height";
animateValueTo = 0;
animateValueFrom = extentY;
break;
case 'width':
case "width":
target.originX = target.originY = 0.5;
animateKey = 'width';
animateKey = "width";
animateValueTo = 0;
animateValueFrom = extentX;
break;
case 'opacity':
animateKey = 'opacity';
case "opacity":
animateKey = "opacity";
animateValueTo = 0;
animateValueFrom = 1;
break;
case 'color':
animateKey = 'backgroundColor';
animateValueTo = 'blue';
animateValueFrom = 'purple';
case "color":
animateKey = "backgroundColor";
animateValueTo = "blue";
animateValueFrom = "purple";
break;
case 'rotate':
case "rotate":
target.originX = target.originY = 0.5;
animateKey = 'rotate';
animateKey = "rotate";
animateValueTo = 180;
animateValueFrom = 0;
break;
case 'scale':
case "scale":
target.originX = target.originY = 0.5;
animateKey = 'scale';
animateKey = "scale";
animateValueTo = {x: 0.1, y: 0.1};
animateValueFrom = {x: 1, y: 1};
break;
default:
throw new Error(`demo animation for '${property}' is not implemented`);
throw new Error(`demo animation for "${property}" is not implemented`);
}
return {
@@ -86,12 +86,12 @@ export function getBoxPropertyAnimationData(property: string,
export function easeAnimate(args) {
const clicked = args.object as Button;
const page: pages.Page = clicked.page;
const select = view.getViewById(page, 'select') as SegmentedBar;
const select = view.getViewById(page, "select") as SegmentedBar;
const item: SegmentedBarItem = select.items[select.selectedIndex];
const animsIn: AnimationDefinition[] = [];
const animsOut: AnimationDefinition[] = [];
for (let i = 0; i < 100; i++) {
const box = view.getViewById(page, 'el-' + i) as Label;
const box = view.getViewById(page, "el-" + i) as Label;
const prop = getBoxPropertyAnimationData(item.title, clicked.text, box, 32, 24);
animsIn.push({
[prop.animateKey]: prop.animateValueTo,

View File

@@ -1,54 +1,54 @@
import * as view from 'tns-core-modules/ui/core/view';
import * as pages from 'tns-core-modules/ui/page';
import {Button} from 'tns-core-modules/ui/button';
import {SegmentedBar, SegmentedBarItem} from 'tns-core-modules/ui/segmented-bar';
import {Label} from 'tns-core-modules/ui/label';
import * as view from "tns-core-modules/ui/core/view";
import * as pages from "tns-core-modules/ui/page";
import { Button } from "tns-core-modules/ui/button";
import { SegmentedBar, SegmentedBarItem } from "tns-core-modules/ui/segmented-bar";
import { Label } from "tns-core-modules/ui/label";
export function easeAnimate(args) {
const clicked = args.object as Button;
const page: pages.Page = clicked.page;
const target = view.getViewById(page, 'target') as Label;
const select = view.getViewById(page, 'select') as SegmentedBar;
const target = view.getViewById(page, "target") as Label;
const select = view.getViewById(page, "select") as SegmentedBar;
const item: SegmentedBarItem = select.items[select.selectedIndex];
const easeType: string = clicked.text;
const extent = 128;
let duration = easeType === 'spring' ? 800 : 500;
let delay = easeType === 'spring' ? 0 : 200;
let duration = easeType === "spring" ? 800 : 500;
let delay = easeType === "spring" ? 0 : 200;
let animateKey: string = null;
let animateValueTo: any = null;
let animateValueFrom: any = null;
switch (item.title) {
case 'height':
animateKey = 'height';
case "height":
animateKey = "height";
target.originX = target.originY = 0;
animateValueTo = 0;
animateValueFrom = extent;
break;
case 'width':
animateKey = 'width';
case "width":
animateKey = "width";
target.originX = target.originY = 0;
animateValueTo = 0;
animateValueFrom = extent;
break;
case 'opacity':
animateKey = 'opacity';
case "opacity":
animateKey = "opacity";
animateValueTo = 0;
animateValueFrom = 1;
break;
case 'color':
animateKey = 'backgroundColor';
animateValueTo = 'blue';
animateValueFrom = 'purple';
case "color":
animateKey = "backgroundColor";
animateValueTo = "blue";
animateValueFrom = "purple";
break;
case 'rotate':
animateKey = 'rotate';
case "rotate":
animateKey = "rotate";
target.originX = target.originY = 0.5;
animateValueTo = 180;
animateValueFrom = 0;
break;
case 'scale':
animateKey = 'scale';
case "scale":
animateKey = "scale";
target.originX = target.originY = 0.5;
animateValueTo = {x: 1.5, y: 1.5};
animateValueFrom = {x: 1, y: 1};

View File

@@ -1,9 +1,9 @@
import * as view from 'tns-core-modules/ui/core/view';
import * as pages from 'tns-core-modules/ui/page';
import * as platform from 'tns-core-modules/platform';
import {Animation} from 'tns-core-modules/ui/animation';
import {TextView} from 'tns-core-modules/ui/text-view';
import {isIOS} from 'tns-core-modules/platform';
import * as view from "tns-core-modules/ui/core/view";
import * as pages from "tns-core-modules/ui/page";
import * as platform from "tns-core-modules/platform";
import { Animation } from "tns-core-modules/ui/animation";
import { TextView } from "tns-core-modules/ui/text-view";
import { isIOS } from "tns-core-modules/platform";
let toggle = false;
@@ -15,7 +15,7 @@ export function pageLoaded(args) {
screenHeight,
screenYCenter,
detailsHeight: 96,
summary: 'Space! 🌌',
summary: "Space! 🌌",
ipsum: `Houston, Tranquillity Base here. The Eagle has landed.
For those who have seen the Earth from space, and for the hundreds and perhaps thousands more who will, the experience most certainly changes your perspective. The things that we share in our world are far more valuable than those which divide us.
@@ -30,7 +30,7 @@ NASA is not about the Adventure of Human Space Exploration…We wont be
Science has not yet mastered prophecy. We predict too much for the next year and yet far too little for the next 10.
Science cuts two ways, of course; its products can be used for both good and evil. But there's no turning back from science. The early warnings about technological dangers also come from science.
Science cuts two ways, of course; its products can be used for both good and evil. But there"s no turning back from science. The early warnings about technological dangers also come from science.
Here men from the planet Earth first set foot upon the Moon. July 1969 AD. We came in peace for all mankind.
@@ -43,13 +43,13 @@ http://spaceipsum.com`
export function theFinalFrontier(args) {
const clicked = args.object as view.View;
const page: pages.Page = clicked.page;
const details = view.getViewById(page, 'details') as TextView;
const details = view.getViewById(page, "details") as TextView;
const ctx = page.bindingContext;
const detailHeaderHeight: number = ctx.detailsHeight;
let statusBar = 0;
if(isIOS) {
const {ios} = require('tns-core-modules/ui/utils');
if (isIOS) {
const {ios} = require("tns-core-modules/ui/utils");
statusBar = ios.getStatusBarHeight();
}
@@ -57,9 +57,9 @@ export function theFinalFrontier(args) {
const transitions = [
{
target: clicked,
height: toggle ? '100%' : detailHeaderHeight,
height: toggle ? "100%" : detailHeaderHeight,
duration: 200,
curve: 'ease'
curve: "ease"
},
{
target: details,
@@ -70,7 +70,7 @@ export function theFinalFrontier(args) {
y: toggle ? 50 : 0,
},
duration: 200,
curve: 'easeIn'
curve: "easeIn"
}
];
const animationSet = new Animation(transitions, false);

View File

@@ -1,4 +1,4 @@
import {Label} from 'tns-core-modules/ui/label';
import { Label } from "tns-core-modules/ui/label";
let toggle = false;
@@ -6,9 +6,9 @@ export function animateHeight(args) {
const clicked = args.object as Label;
clicked
.animate({
height: toggle ? 128 : '100%',
height: toggle ? 128 : "100%",
duration: 200,
curve: 'easeInOut'
curve: "easeInOut"
})
.then(() => {
clicked.text = toggle ? "Cool." : "Tap here";

View File

@@ -1,4 +1,4 @@
import * as view from 'tns-core-modules/ui/core/view';
import * as view from "tns-core-modules/ui/core/view";
export function tapLabel(args) {
const clicked: view.View = args.object;
@@ -6,7 +6,7 @@ export function tapLabel(args) {
clicked.animate({
height: graffiti.toggle ? 64 : 128,
duration: 200,
curve: 'easeOut'
curve: "easeOut"
});
graffiti.toggle = !graffiti.toggle;
}