New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nativescript-effects

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-effects - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

4

effects.android.d.ts
import { Common } from './effects.common';
import * as viewModule from 'tns-core-modules/ui/core/view';
import {View} from '@nativescript/core/ui';
export declare class Effects extends Common {
private _view;
constructor(view: viewModule.View);
constructor(view: View);
nativeSpring(animation: any): Promise<void>;
}

@@ -1,14 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var effects_common_1 = require("./effects.common");
var viewModule = require("tns-core-modules/ui/core/view");
var Effects = (function (_super) {
__extends(Effects, _super);
function Effects(view) {
var _this = _super.call(this) || this;
_this._view = view;
return _this;
import { Common } from './effects.common';
import { View } from '@nativescript/core/ui';
export class Effects extends Common {
constructor(view) {
super();
this._view = view;
}
Effects.prototype.nativeSpring = function (animation) {
var def = {
nativeSpring(animation) {
let def = {
scale: { x: animation.scale.x, y: animation.scale.y },

@@ -21,11 +17,9 @@ translate: { x: animation.translate.x, y: animation.translate.y },

return this._view.animate(def);
};
return Effects;
}(effects_common_1.Common));
exports.Effects = Effects;
viewModule.View.prototype.spring = function (duration, animation) {
}
}
View.prototype.spring = function (duration, animation) {
if (duration === void 0) {
duration = Effects.defaultDuration;
}
var msDuration = Effects.getMsValue(duration);
const msDuration = Effects.getMsValue(duration);
if (!animation) {

@@ -51,5 +45,5 @@ animation = {

}
var fx = new Effects(this);
const fx = new Effects(this);
return fx.nativeSpring(animation);
};
//# sourceMappingURL=effects.android.js.map

@@ -1,2 +0,3 @@

import { Observable } from 'tns-core-modules/data/observable';
import { Observable } from "@nativescript/core";
export declare class Common extends Observable {

@@ -7,15 +8,15 @@ static defaultDuration: number;

static presetDirections: {
'up': {
up: {
x: number;
y: number;
};
'down': {
down: {
x: number;
y: number;
};
'left': {
left: {
x: number;
y: number;
};
'right': {
right: {
x: number;

@@ -26,6 +27,6 @@ y: number;

static presetDurations: {
'fast': number;
'slow': number;
fast: number;
slow: number;
};
static getMsValue(duration: any): any;
}

@@ -1,19 +0,12 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var observable_1 = require("tns-core-modules/data/observable");
var viewModule = require("tns-core-modules/ui/core/view");
var typesModule = require("tns-core-modules/utils/types");
var enums = require("tns-core-modules/ui/enums");
var Common = (function (_super) {
__extends(Common, _super);
function Common() {
return _super !== null && _super.apply(this, arguments) || this;
}
Common.getMsValue = function (duration) {
if (typesModule.isString(duration)) {
if (typesModule.isDefined(Common.presetDurations[duration])) {
import { Observable, Enums } from '@nativescript/core';
import { View } from '@nativescript/core/ui';
import { isDefined, isNumber, isString } from '@nativescript/core/utils/types';
export class Common extends Observable {
static getMsValue(duration) {
if (isString(duration)) {
if (isDefined(Common.presetDurations[duration])) {
return this.presetDurations[duration];
}
}
else if (typesModule.isNumber(duration)) {
else if (isNumber(duration)) {
return duration;

@@ -24,5 +17,4 @@ }

}
};
return Common;
}(observable_1.Observable));
}
}
Common.defaultDuration = 400;

@@ -41,9 +33,8 @@ Common.defaultSlideDistance = -100;

};
exports.Common = Common;
viewModule.View.prototype.fadeIn = function (duration) {
View.prototype.fadeIn = function (duration) {
if (duration === void 0) {
duration = Common.defaultDuration;
}
var msDuration = Common.getMsValue(duration);
this.visibility = enums.Visibility.visible;
const msDuration = Common.getMsValue(duration);
this.visibility = Enums.Visibility.visible;
return this.animate({

@@ -54,7 +45,7 @@ opacity: 1,

};
viewModule.View.prototype.fadeOut = function (duration) {
View.prototype.fadeOut = function (duration) {
if (duration === void 0) {
duration = Common.defaultDuration;
}
var msDuration = Common.getMsValue(duration);
const msDuration = Common.getMsValue(duration);
return this.animate({

@@ -65,3 +56,3 @@ opacity: 0,

};
viewModule.View.prototype.fadeTo = function (duration, opacity) {
View.prototype.fadeTo = function (duration, opacity) {
if (duration === void 0) {

@@ -73,4 +64,4 @@ duration = Common.defaultDuration;

}
var msDuration = Common.getMsValue(duration);
this.visibility = enums.Visibility.visible;
const msDuration = Common.getMsValue(duration);
this.visibility = Enums.Visibility.visible;
return this.animate({

@@ -81,3 +72,3 @@ opacity: opacity,

};
viewModule.View.prototype.fadeToggle = function (duration) {
View.prototype.fadeToggle = function (duration) {
if (duration === void 0) {

@@ -93,3 +84,3 @@ duration = Common.defaultDuration;

};
viewModule.View.prototype.floatIn = function (duration, direction) {
View.prototype.floatIn = function (duration, direction) {
if (duration === void 0) {

@@ -101,10 +92,10 @@ duration = Common.defaultDuration;

}
var self = this;
var msDuration = Common.getMsValue(duration);
this.visibility = enums.Visibility.visible;
var dir = Common.presetDirections[direction];
const self = this;
const msDuration = Common.getMsValue(duration);
this.visibility = Enums.Visibility.visible;
let dir = Common.presetDirections[direction];
if (!dir) {
dir = Common.presetDirections['up'];
}
var promiseSetup = self.animate({
const promiseSetup = self.animate({
translate: { x: dir.x, y: dir.y },

@@ -122,3 +113,3 @@ opacity: 0,

};
viewModule.View.prototype.floatOut = function (duration, direction) {
View.prototype.floatOut = function (duration, direction) {
if (duration === void 0) {

@@ -130,4 +121,4 @@ duration = Common.defaultDuration;

}
var msDuration = Common.getMsValue(duration);
var dir = Common.presetDirections[direction];
const msDuration = Common.getMsValue(duration);
let dir = Common.presetDirections[direction];
if (!dir) {

@@ -142,21 +133,21 @@ dir = Common.presetDirections['down'];

};
viewModule.View.prototype.hide = function (duration) {
View.prototype.hide = function (duration) {
if (duration === void 0) {
duration = 1;
}
this.visibility = enums.Visibility.collapse;
this.visibility = Enums.Visibility.collapse;
return this.fadeOut(duration);
};
viewModule.View.prototype.show = function (duration) {
View.prototype.show = function (duration) {
if (duration === void 0) {
duration = 1;
}
this.visibility = enums.Visibility.visible;
this.visibility = Enums.Visibility.visible;
return this.fadeIn(duration);
};
viewModule.View.prototype.toggle = function (duration) {
View.prototype.toggle = function (duration) {
if (duration === void 0) {
duration = 1;
}
if (this.visibility === enums.Visibility.collapse) {
if (this.visibility === Enums.Visibility.collapse) {
return this.show(duration);

@@ -168,3 +159,3 @@ }

};
viewModule.View.prototype.slideDown = function (duration, distance) {
View.prototype.slideDown = function (duration, distance) {
if (duration === void 0) {

@@ -176,8 +167,8 @@ duration = Common.defaultDuration;

}
var self = this;
var msDuration = Common.getMsValue(duration);
this.visibility = enums.Visibility.visible;
const self = this;
const msDuration = Common.getMsValue(duration);
this.visibility = Enums.Visibility.visible;
this.translateY = distance;
this.opacity = 0;
var promiseSetup = self.animate({
const promiseSetup = self.animate({
translate: { x: 0, y: distance },

@@ -195,3 +186,3 @@ opacity: 0,

};
viewModule.View.prototype.slideUp = function (duration, distance) {
View.prototype.slideUp = function (duration, distance) {
if (duration === void 0) {

@@ -203,3 +194,3 @@ duration = Common.defaultDuration;

}
var msDuration = Common.getMsValue(duration);
const msDuration = Common.getMsValue(duration);
return this.animate({

@@ -211,3 +202,3 @@ translate: { x: 0, y: distance },

};
viewModule.View.prototype.slideToggle = function (duration, distance) {
View.prototype.slideToggle = function (duration, distance) {
if (duration === void 0) {

@@ -226,14 +217,14 @@ duration = Common.defaultDuration;

};
viewModule.View.prototype.shake = function () {
var view = this;
View.prototype.shake = function () {
const view = this;
return new Promise(function (resolve, reject) {
view.animate({ translate: { x: -20, y: 0 }, duration: 60, curve: enums.AnimationCurve.linear })
.then(function () { return view.animate({ translate: { x: 20, y: 0 }, duration: 60, curve: enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: -20, y: 0 }, duration: 60, curve: enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: 20, y: 0 }, duration: 60, curve: enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: -10, y: 0 }, duration: 60, curve: enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: 10, y: 0 }, duration: 60, curve: enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: -5, y: 0 }, duration: 60, curve: enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: 5, y: 0 }, duration: 60, curve: enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: 0, y: 0 }, duration: 60, curve: enums.AnimationCurve.linear }); })
view.animate({ translate: { x: -20, y: 0 }, duration: 60, curve: Enums.AnimationCurve.linear })
.then(function () { return view.animate({ translate: { x: 20, y: 0 }, duration: 60, curve: Enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: -20, y: 0 }, duration: 60, curve: Enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: 20, y: 0 }, duration: 60, curve: Enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: -10, y: 0 }, duration: 60, curve: Enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: 10, y: 0 }, duration: 60, curve: Enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: -5, y: 0 }, duration: 60, curve: Enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: 5, y: 0 }, duration: 60, curve: Enums.AnimationCurve.linear }); })
.then(function () { return view.animate({ translate: { x: 0, y: 0 }, duration: 60, curve: Enums.AnimationCurve.linear }); })
.then(function () {

@@ -240,0 +231,0 @@ return resolve(view);

import { Common } from './effects.common';
import * as viewModule from 'tns-core-modules/ui/core/view';
import { View } from '@nativescript/core/ui';
export declare class Effects extends Common {
private _view;
constructor(view: viewModule.View);
constructor(view: View);
nativeSpring(animation: any): Promise<any>;
}

@@ -1,16 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var effects_common_1 = require("./effects.common");
var viewModule = require("tns-core-modules/ui/core/view");
var Effects = (function (_super) {
__extends(Effects, _super);
function Effects(view) {
var _this = _super.call(this) || this;
_this._view = view;
return _this;
import { View } from '@nativescript/core/ui';
import { Common } from './effects.common';
export class Effects extends Common {
constructor(view) {
super();
this._view = view;
}
Effects.prototype.nativeSpring = function (animation) {
var _this = this;
var aTrans = { x: 0, y: 0 };
var aScale = { x: 1, y: 1 };
nativeSpring(animation) {
const aTrans = { x: 0, y: 0 };
const aScale = { x: 1, y: 1 };
if (animation.translate) {

@@ -28,9 +23,9 @@ if (animation.translate.x)

}
return new Promise(function (resolve, reject) {
return new Promise((resolve, reject) => {
try {
UIView.animateWithDurationDelayUsingSpringWithDampingInitialSpringVelocityOptionsAnimationsCompletion(animation.duration / 1000, animation.delay / 1000, animation.dampingRatio, animation.velocity, animation.options, function () {
_this._view.translateX = aTrans.x;
_this._view.translateY = aTrans.y;
_this._view.scaleX = aScale.x;
_this._view.scaleY = aScale.y;
UIView.animateWithDurationDelayUsingSpringWithDampingInitialSpringVelocityOptionsAnimationsCompletion(animation.duration / 1000, animation.delay / 1000, animation.dampingRatio, animation.velocity, animation.options, () => {
this._view.translateX = aTrans.x;
this._view.translateY = aTrans.y;
this._view.scaleX = aScale.x;
this._view.scaleY = aScale.y;
}, resolve);

@@ -42,11 +37,9 @@ }

});
};
return Effects;
}(effects_common_1.Common));
exports.Effects = Effects;
viewModule.View.prototype.spring = function (duration, animation) {
}
}
View.prototype.spring = function (duration, animation) {
if (duration === void 0) {
duration = Effects.defaultDuration;
}
var msDuration = Effects.getMsValue(duration);
const msDuration = Effects.getMsValue(duration);
if (!animation) {

@@ -72,5 +65,5 @@ animation = {

}
var fx = new Effects(this);
const fx = new Effects(this);
return fx.nativeSpring(animation);
};
//# sourceMappingURL=effects.ios.js.map
{
"name": "nativescript-effects",
"version": "1.0.0",
"version": "2.0.0",
"description": "A NativeScript plugin that extend animations to include common animation scenarios.",
"main": "effects",
"typings": "tns-effects.d.ts",
"nativescript": {
"platforms": {
"android": "3.0.0",
"ios": "3.0.0"
}
},
"repository": {

@@ -18,3 +12,4 @@ "type": "git",

"scripts": {
"tsc": "tsc -skipLibCheck",
"tsc": "tsc",
"build": "npm i && ts-patch install && tsc",
"postclone": "npm i && node scripts/postclone.js && cd ../demo && npm i && cd ../src && npm run plugin.link",

@@ -59,14 +54,18 @@ "test.android": "npm i && npm run tsc && npm run tslint && cd ../demo && tns build android && tns test android --justlaunch",

"peerDependencies": {
"tns-core-modules": "^3.0.0"
"@nativescript/core": "7.0.0"
},
"devDependencies": {
"tns-core-modules": "^3.1.0",
"tns-platform-declarations": "^3.1.0",
"typescript": "~2.3.0",
"@nativescript/core": "7.0.0",
"@nativescript/types": "^7.0.4",
"@nativescript/webpack": "~3.0.8",
"typescript": "4.0.5",
"prompt": "^1.0.0",
"rimraf": "^2.5.0",
"tslint": "^5.0.0"
"tslint": "5.18.0",
"ts-patch": "1.3.0"
},
"dependencies": {},
"dependencies": {
"ts-node": "^9.0.0"
},
"bootstrapper": "nativescript-plugin-seed"
}
}

@@ -1,2 +0,1 @@

/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
/// <reference path="./node_modules/@nativescript/types/index.d.ts" />
import { Common } from './effects.common';
import { View } from 'tns-core-modules/ui/core/view';
import { View } from '@nativescript/core/ui';
declare module 'tns-core-modules/ui/core/view' {
interface View {
declare module '@nativescript/core/ui' {
interface View
{
fadeIn(duration?: string | number): Promise<void>;

@@ -28,3 +29,4 @@ fadeOut(duration?: string | number): Promise<void>;

export declare class Effects extends Common {
export declare class Effects extends Common
{
// define your typings manually

@@ -31,0 +33,0 @@ // or..

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc