Snow for your Titanium app
Titanium Ace Snow 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.
Contents
Download
Example codes
//include snow object
Ti.include('Ace.snow.js');
//create main window
var win = Titanium.UI.createWindow({
title:'Snowing window',
backgroundColor:'#000'
});
//generate snow
var snow = new Ace.snow(win, {
//color of snowflake
//use image property to provide image
color: 'white',
//time to take for one snowflake to fall(ms)
fallingTime: 12000,
//interval between snowflakes(ms)
flakeInterval: 800,
//flake size
flakeSize: 10,
//difference between size for smallest and largest
sizeDelta: 5,
//animation curve
curve: Titanium.UI.ANIMATION_CURVE_EASE_IN_OUT,
//should snow flakes fade out while falling
fadeOut: true,
//should snow start automatically
autoStart: true
});
Example video
Video of module example app:
Method list
Constructor
| Method name | new snow(window, config); |
| Description | Create snow instance for specified window |
| Input parameters | window - Titanium window object, where snow will appear json config - Json structure with configuration properties
|
| Example input | var snow = new Ace.snow(win); |
Start snow
| Method name | start() |
| Description | Start snowing if sowing was stopped or wasn't started automatically |
Stop snow
| Method name | stop() |
| Description | Stop new flakes from appearing |
Add flake
| Method name | addFlake(x, r) |
| Description | Snow flakes will appear automatically based on provided configuration, but it is possible to add additional snowflakes using this method |
| Input parameters | int x - coordinate on x axis, where snow should appear (deault: random, limited by screen width) int r - radius of snowflake (default: random, limited by provided configuration) |
Latest changes
None for nowYou may also be interested in:
Powered by BlogAlike.com








