File: app.js

Recommend this page to a friend!
  Classes of Arturs Sosins   Ace snow   app.js   Download  
File: app.js
Role: Example script
Content type: text/plain
Description: Example app
Class: Ace snow
Create snow falling effect for Titanium apps
Author: By
Last change: Changed to use new CommonJS module
Date: 11 years ago
Size: 1,891 bytes
 

Contents

Class file image Download
/************************************************************* * This script is developed by Arturs Sosins aka ar2rsawseen, http://appcodingeasy.com * Feel free to distribute and modify code, but keep reference to its creator * * This Titanium object creates a falling snowflake effect for your application window. * It is possible to set quantity and speed of flakes, and also provide image of custom * snowflake. This object also provides methods to start or stop snowing and add flakes. * * For more information, examples and online documentation visit: * http://appcodingeasy.com/Titanium-Mobile/Snow-for-your-Titanium-app **************************************************************/ //create main windows var win = Titanium.UI.createWindow({ title:'Tab 1', backgroundColor:'#000' }); //create countdown var AceSnow = require('AceSnow'); //generate snow var snow = new AceSnow(win, { color: "white", fallingTime: 12000, flakeInterval: 800, flakeSize: 10, sizeDelta: 5, curve: Titanium.UI.ANIMATION_CURVE_EASE_IN_OUT, fadeOut: true, autoStart: true }); //for button generation var createButton = function(text, top, callback){ var button = Ti.UI.createButton({ height:50, width:"50%", color:'#fff', title: text, font: { fontSize:14, fontFamily:'Helvetica Neue', fontWeight:'bold' }, left:"25%", right:"25%", top:top }); button.addEventListener('click', callback); return button; }; //create button to start snow win.add(createButton("Start snow", 100, function(){ snow.start(); })); //create button to stop snow win.add(createButton("Stop snow", 150, function(){ snow.stop(); })); //create button to add flake win.add(createButton("Add Flake", 200, function(){ snow.addFlake(); })); win.open();