X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=hacks%2FNimbus%2FNimbus.js;h=7bc5c7c469aca854c45b520e81083b343ca87a14;hb=98d8bc4d5f0bc0b315b54369a8f288d93e9b2c44;hp=f8ed71945b326a86ed0e411d049b1036c400fd54;hpb=7f476a519a8abeecf6c1e19e4e91635ea324d608;p=Hacks.git diff --git a/hacks/Nimbus/Nimbus.js b/hacks/Nimbus/Nimbus.js index f8ed719..7bc5c7c 100644 --- a/hacks/Nimbus/Nimbus.js +++ b/hacks/Nimbus/Nimbus.js @@ -41,6 +41,17 @@ enyo.kind({ drop_c: 0, drops: [], perspective: 0.3, + preferences: [ + {name: "intensity", label: "Intensity", kind: "Slider", maximum: 1, minimum: 0, snap: 0.01}, + {name: "rainColor", label: "Rain Color", kind: "ListSelector", items: ["gray", "black", "blue", "red"]}, + {name: "backgroundColor", label: "Background Color", kind: "ListSelector", items: [ + {caption: "white", value: 'rgba(255,255,255,0.7)'}, + {caption: "black", value: 'rgba(0,0,0,0.7)'} + ]} + ], + intensity: 0.7, + rainColor: 'gray', + backgroundColor: 'rgba(255,255,255,0.7)', components: [ {name: "raindrops", nodeTag: "canvas"} ], @@ -64,12 +75,16 @@ enyo.kind({ this.raindrops.width = this.w = w; this.raindrops.height = this.h = h; - this.ctx.fillStyle = 'rgba(255,255,255,0.7)'; - this.ctx.strokeStyle = 'rgb(128,128,128)'; + this.ctx.fillStyle = this.backgroundColor; + this.ctx.strokeStyle = this.rainColor; this.ctx.lineWidth = '2'; }, + preferencesChanged: function() { + this.ctx.fillStyle = this.backgroundColor; + this.ctx.strokeStyle = this.rainColor; + }, draw: function() { - if (Math.random() > 0.3) { + if (Math.random() <= this.intensity) { this.drops[this.drop_c].start(this.w, this.h, this.perspective); this.drop_c = (this.drop_c + 1) % 100; }