hooking up the lights :D :D :D

This commit is contained in:
Egor 2015-09-17 23:51:43 -07:00
parent 8fe729d02c
commit 910c921e83
4 changed files with 33 additions and 23 deletions

View file

@ -241,36 +241,43 @@ export default Em.Component.extend(musicControlMixin, {
threshold = this.get('threshold'),
decay = this.get('decay'),
frequency = this.get('frequency'),
//briOff = function (i) {
// Em.$.ajax(self.get('apiURL') + '/lights/' + i + '/state', {
// data: JSON.stringify({'bri': 1, 'transitiontime': 0}),
// contentType: 'application/json',
// type: 'PUT'
// });
//},
briOff = function (i) {
Em.$.ajax(self.get('apiURL') + '/lights/' + i + '/state', {
data: JSON.stringify({'bri': 1, 'transitiontime': 0}),
contentType: 'application/json',
type: 'PUT'
});
},
kick = dancer.createKick({
threshold: threshold,
decay: decay,
frequency: frequency,
onKick: function (mag) {
var activeLights = self.get('activeLights');
if (self.get('paused') === false) {
//for (let i = 1; i <= 1; i++) {
// Em.$.ajax(self.get('apiURL') + '/lights/' + i + '/state', {
// data: JSON.stringify({'bri': 254, 'transitiontime': 0}),
// contentType: 'application/json',
// type: 'PUT'
// });
//
// setTimeout(briOff, 50, i);
//}
//work the lights
if(activeLights.length > 0){
var lastLightBopIndex = self.get('lastLightBopIndex'), light = self.get('activeLights')[lastLightBopIndex];
Em.$.ajax(self.get('apiURL') + '/lights/' + light + '/state', {
data: JSON.stringify({'bri': 254, 'transitiontime': 0}),
contentType: 'application/json',
type: 'PUT'
});
self.set('paused', true);
setTimeout(briOff, 50, light);
lastLightBopIndex = (lastLightBopIndex+1)%activeLights.length;
setTimeout(function () {
self.set('paused', false);
}, 150);
self.setProperties({
paused: true,
lastLightBopIndex: lastLightBopIndex
});
setTimeout(function () {
self.set('paused', false);
}, 150);
}
//work the music beat area
if(self.get('speakerViewed')){
self.send('clickSpeaker');
} else {

View file

@ -57,6 +57,7 @@ export default Em.Mixin.create({
maxBeatHistorySize: 30,
timeElapsed: 0,
timeTotal: 0,
lastLightBopIndex: 0,
dragging: false,
draggingOverPlayListArea: false,

View file

@ -466,6 +466,7 @@ md-toolbar {
border-radius: 5px;
transition: 0.1s all ease-in-out;
position: relative;
overflow: auto;
#dragHere {
position: absolute;
top: 27%;
@ -499,6 +500,7 @@ md-toolbar {
}
.playlistItem {
border-bottom: 1px solid #9E9E9E;
height: 45px;
font-family: 'Open Sans', sans-serif;
padding: 5px;

View file

@ -67,12 +67,12 @@
<span id="beatOptionGroup">
<span class="beatOption">
{{range-slider start=threshold orientation="vertical" range=beatOptions.threshold.range slide="thresholdChanged" pips=beatOptions.threshold.pips}}
Beat Threshold
Max. Beat Intensity
</span>
<span class="beatOption">
{{range-slider start=decay orientation="vertical" step=beatOptions.decay.step range=beatOptions.decay.range slide="decayChanged" pips=beatOptions.decay.pips}}
Beat Decay
Beat Decay Rate
</span>
<span class="beatOption">