Comparing version 0.1.6 to 0.1.7
/** | ||
* this is a collection of alloy animations | ||
* A collection of useful Animation utilities | ||
*/ | ||
var utils = require('./utils.js'); | ||
exports.animate = function() | ||
{ | ||
alert(utils.test()); | ||
} | ||
exports.crossFade = function (from, to, duration, callback) { | ||
if (from) | ||
from.animate({ | ||
opacity: 0, | ||
duration: duration | ||
}); | ||
if (to) | ||
to.animate({ | ||
opacity: 1, | ||
duration: duration | ||
}); | ||
if (callback) | ||
setTimeout(callback, duration + 300); | ||
}; | ||
exports.fadeAndRemove = function (from, duration, container) { | ||
if (from && container) { | ||
from.animate({ | ||
opacity: 0, | ||
duration: duration | ||
}, function () { | ||
container.remove(from); | ||
container = from = duration = null; | ||
}); | ||
} | ||
}; | ||
exports.fadeIn = function (to, duration) { | ||
if (to) { | ||
to.animate({ | ||
opacity: 1, | ||
duration: duration | ||
}); | ||
} | ||
}; | ||
exports.popIn = function (view) { | ||
if (!OS_IOS) | ||
{ | ||
view.transform = Ti.UI.create2DMatrix(); | ||
view.opacity = 1; | ||
return; | ||
} | ||
var animate1 = Ti.UI.createAnimation({ | ||
opacity: 1, | ||
transform: Ti.UI.create2DMatrix().scale(1.05, 1.05), | ||
duration: 200 | ||
}); | ||
var animate2 = Ti.UI.createAnimation({ | ||
transform: Ti.UI.create2DMatrix(), | ||
duration: 300 | ||
}); | ||
exports.chainAnimate(view, [ animate1, animate2 ]); | ||
view = null; | ||
}; | ||
exports.shake = function (view, delay) { | ||
var shake1 = Ti.UI.createAnimation({ | ||
transform: Ti.UI.create2DMatrix().translate(5, 0), | ||
duration: 100 | ||
}); | ||
var shake2 = Ti.UI.createAnimation({ | ||
transform: Ti.UI.create2DMatrix().translate(-5, 0), | ||
duration: 100 | ||
}); | ||
var shake3 = Ti.UI.createAnimation({ | ||
transform: Ti.UI.create2DMatrix().translate(5, 0), | ||
duration: 100 | ||
}); | ||
var shake4 = Ti.UI.createAnimation({ | ||
transform: Ti.UI.create2DMatrix().translate(-5, 0), | ||
duration: 100 | ||
}); | ||
var shake5 = Ti.UI.createAnimation({ | ||
transform: Ti.UI.create2DMatrix(), | ||
duration: 100 | ||
}); | ||
if (delay) { | ||
setTimeout(function () { | ||
exports.chainAnimate(view, [ shake1, shake2, shake3, shake4, shake5 ]); | ||
view = shake1 = shake2 = shake3 = shake4 = shake5 = null; | ||
}, delay); | ||
} | ||
else { | ||
exports.chainAnimate(view, [ shake1, shake2, shake3, shake4, shake5 ]); | ||
} | ||
}; | ||
exports.flash = function (view, delay) { | ||
var flash1 = Ti.UI.createAnimation({ | ||
opacity: 0.7, | ||
duration: 100 | ||
}); | ||
var flash2 = Ti.UI.createAnimation({ | ||
opacity: 1, | ||
duration: 100 | ||
}); | ||
var flash3 = Ti.UI.createAnimation({ | ||
opacity: 0.7, | ||
duration: 100 | ||
}); | ||
var flash4 = Ti.UI.createAnimation({ | ||
opacity: 1, | ||
duration: 100 | ||
}); | ||
if (delay) { | ||
setTimeout(function () { | ||
exports.chainAnimate(view, [ flash1, flash2, flash3, flash4 ]); | ||
view = flash1 = flash2 = flash3 = flash4 = null; | ||
}, delay); | ||
} | ||
else { | ||
exports.chainAnimate(view, [ flash1, flash2, flash3, flash4 ]); | ||
} | ||
}; | ||
exports.chainAnimate = function (view, animations) { | ||
function step() { | ||
if (animations.length == 0) { | ||
view = animations = null; | ||
return; | ||
} | ||
var animation = animations.shift(); | ||
animation.addEventListener('complete', step); | ||
view.animate(animation); | ||
} | ||
step(); | ||
}; |
@@ -199,3 +199,3 @@ var path = require('path'), | ||
// actually require in our app - saving space and memory | ||
var builtInsDir = path.join(__dirname,'builtins'); | ||
var builtInsDir = path.join(__dirname,'..','builtins'); | ||
function alloyFilter(fn) | ||
@@ -272,3 +272,3 @@ { | ||
function fixRequirePaths() | ||
function fixRequirePaths(config) | ||
{ | ||
@@ -283,3 +283,3 @@ var resourcesDir = path.join(outputPath,'Resources'); | ||
// we fix require paths to make sure they are correct and relative to the project | ||
var newSrc = requires.makeRequiresRelative(f,resourcesDir); | ||
var newSrc = requires.makeRequiresRelative(f,resourcesDir,config); | ||
fs.writeFileSync(f,newSrc,'utf-8'); | ||
@@ -659,3 +659,3 @@ } | ||
copyBuiltins(); | ||
fixRequirePaths(); | ||
fixRequirePaths(alloyConfig); | ||
@@ -662,0 +662,0 @@ if (program.dump) console.log(code.blue); |
@@ -88,3 +88,3 @@ var jsp = require("./uglify-js/uglify-js").parser, | ||
function makeRequiresRelative(fn,resourcesDir) | ||
function makeRequiresRelative(fn,resourcesDir,config) | ||
{ | ||
@@ -123,3 +123,3 @@ var basedir = path.dirname(path.resolve(fn)); | ||
return U.formatAST(ast,true); | ||
return U.formatAST(ast,true,config); | ||
} | ||
@@ -126,0 +126,0 @@ |
@@ -178,5 +178,27 @@ // The island of misfit toys... for functions | ||
exports.formatAST = function(ast,beautify) | ||
exports.formatAST = function(ast,beautify,config) | ||
{ | ||
// use the general defaults from the uglify command line | ||
var defines = {}, | ||
DEFINES, | ||
config; | ||
config = config || {}; | ||
config.deploytype = config.deploytype || 'development'; | ||
config.beautify = config.beautify || true; | ||
DEFINES = { | ||
OS_IOS : config.platform == 'ios', | ||
OS_ANDROID: config.platform == 'android', | ||
OS_MOBILEWEB: config.platform == 'mobileweb', | ||
ENV_DEV: config.deploytype == 'development', | ||
ENV_DEVELOPMENT: config.deploytype == 'development', | ||
ENV_TEST: config.deploytype == 'test', | ||
ENV_PRODUCTION: config.deploytype == 'production' | ||
}; | ||
for (var k in DEFINES) { | ||
defines[k] = [ "num", DEFINES[k] ? 1 : 0 ]; | ||
} | ||
var options = | ||
@@ -193,3 +215,3 @@ { | ||
unsafe: false, | ||
defines: exports.defines, | ||
defines: defines, | ||
lift_vars: false, | ||
@@ -196,0 +218,0 @@ codegen_options: { |
@@ -16,3 +16,3 @@ { | ||
], | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"author": "Appcelerator, Inc. <info@appcelerator.com>", | ||
@@ -19,0 +19,0 @@ "maintainers": [ |
var exec = require('child_process').exec; | ||
describe('when the CLI receives no arguments', function() { | ||
//TODO: this is shitty default behavior and should be changed to display all commands and help | ||
it('will prompt the user to specify an action', function() { | ||
@@ -21,3 +20,3 @@ var done, output; | ||
console.log(output); | ||
expect(output).toContain('You must supply an ACTION as the first argument'); | ||
expect(output).toContain('Alloy by Appcelerator. The MVC app framework for Titanium.'); | ||
}); | ||
@@ -24,0 +23,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
857286
242
13981