Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Flavio De Stefano committed Nov 26, 2014
1 parent 262b117 commit 6cf7451
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 25 deletions.
30 changes: 15 additions & 15 deletions README.md
Expand Up @@ -40,32 +40,32 @@ And stylize globally via *app.tss*:
width: 320,
height: 150,
backgroundColor: 'black',
borderColor: 'red',
noise: 0.5
}
```

## Constructor options
## Properties

#### `color` (String)
The color of the wave
#### `[speed]` (Number, from `0` to `1`, default: `0.1`)

#### `autostart` (Boolean, default: `true`)
Autostart the wave?
The speed of the wave.

#### `noise` (Number, from `0` to `1`)
The noise of the wave
#### `[amplitude]` (Number, from `0` to `1`, default: `1`)

#### `speed` (Number, from `0` to N)
The speed of the wave
The noise (amplitude) of the wave.

## API
#### `[frequency]` (Number, from `0` to `N`, default: `1`)

The noise (amplitude) of the wave.

#### `[color]` (String, Color, default: `#fff')

#### `setNoise([ 0...1 ])`
Set the noise at runtime
The color of the wave, in hexadecimal form (`#336699`, `#FF0`)

## API

#### `setSpeed(N)`
Set the speed at runtime
#### `set(property, value)`
Set the property at runtime

#### `start()`
Start the wave
Expand Down
18 changes: 12 additions & 6 deletions controllers/widget.js
@@ -1,6 +1,6 @@
var args = _.extend({
width: 320,
height: 150,
width: $.cfn_SiriWave.size.width || 320,
height: $.cfn_SiriWave.size.height || 150,
ratio: OS_ANDROID ? Ti.Platform.displayCaps.logicalDensityFactor : Ti.Platform.displayCaps.dpi/160
}, arguments[0]);

Expand All @@ -10,19 +10,25 @@ function init() {
html += '<meta name="viewport" content="width=device-width, user-scalable=no,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0" />';
html += '<style>html,body{margin:0;padding:0;}</style>';
html += '</head><body>';
html += '<script src="'+WPATH("/SiriWaveJS/siriwave.js")+'"></script>';
Ti.API.debug(args);

if (Ti.Shadow) {
html += '<script>' + Ti.Filesystem.getFile(WPATH("SiriWaveJS/siriwave.js")).read().text + '</script>';
} else {
html += '<script src="' + WPATH("/SiriWaveJS/siriwave.js") + '"></script>';
}
html += '<script>window.SW = new SiriWave(' + JSON.stringify(args) + ');</script>';
html += '</body></html>';
$.siriWave.html = html;
$.cfn_SiriWave.html = html;
}

function call(fn, val) {
$.siriWave.evalJS('window.SW.' + fn + '(' + (val == null ? '' : JSON.stringify(val)) + ');');
$.cfn_SiriWave.evalJS('window.SW.' + fn + '(' + (val == null ? '' : JSON.stringify(val)) + ');');
}
exports.call = call;

function set(prop, val) {
$.siriWave.evalJS('window.SW.' + prop + '=' + JSON.stringify(val));
$.cfn_SiriWave.evalJS('window.SW.' + prop + '=' + JSON.stringify(val));
}
exports.set = set;

Expand Down
4 changes: 2 additions & 2 deletions styles/widget.tss
@@ -1,6 +1,6 @@
".siriWave": {
".cfn_SiriWave": {
touchEnabled: false,
width: 320,
width: Ti.UI.FILL,
height: 150,
backgroundColor: 'transparent',
hideLoadIndicator: true,
Expand Down
2 changes: 1 addition & 1 deletion views/widget.xml
@@ -1,3 +1,3 @@
<Alloy>
<WebView id="siriWave" class="siriWave" />
<WebView id="cfn_SiriWave" class="cfn_SiriWave" />
</Alloy>
2 changes: 1 addition & 1 deletion widget.json
Expand Up @@ -3,7 +3,7 @@
"name": "Ti.SiriWaveJS",
"description" : "SiriwaveJS porting for Titanium as Alloy widget.",
"author": "Flavio De Stefano",
"version": "1.0.2",
"version": "1.0.3",
"copyright":"Copyright (c) 2014",
"license":"Apache License, Version 2.0",
"min-alloy-version": "1.0",
Expand Down

0 comments on commit 6cf7451

Please sign in to comment.