From d8bd910bcad9234050a1b13dfcf6db9c99983711 Mon Sep 17 00:00:00 2001 From: Patrick Boyd Date: Mon, 2 Jul 2018 17:48:21 -0500 Subject: [PATCH] Add preset animations --- index.html | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index d35c463..a22c073 100644 --- a/index.html +++ b/index.html @@ -60,6 +60,7 @@ socket.on('init', function (msg) { $('#presets').empty(); $('#sliders').empty(); + $('#anim').empty(); setup = msg.setup devices = msg.devices @@ -73,7 +74,6 @@ socket.emit('update', universe, values[universe]); } };}(setup.presets[preset].values)); - console.log(html); } /* blackout button */ @@ -109,6 +109,26 @@ html += ""; $(html).hide().appendTo('#sliders').fadeIn(); } + + /* animations */ + for(var animation in setup.animPresets) { + var html = ''; + var e = $(html) + e.hide().appendTo('#anim').fadeIn(); + e.click(function(values) { return function() { + for(var universe in values) { + $.ajax({ + type: 'POST', + contentType: 'application/json', + data: JSON.stringify(values[universe]), + url: '/animation/'+universe, + processData: false, + dataType: 'json' + }); + } + };}(setup.animPresets[animation].anim)); + } + $("input").live("change", function(e) { var i = e.target.id.split('_'); var u = {}; @@ -131,6 +151,7 @@ @@ -144,6 +165,9 @@
+
+
+
@@ -151,4 +175,4 @@
- \ No newline at end of file +