diff --git a/software/pc/animationbuilder/animationbuilder.html b/software/pc/animationbuilder/animationbuilder.html index cd19fc3..4229313 100644 --- a/software/pc/animationbuilder/animationbuilder.html +++ b/software/pc/animationbuilder/animationbuilder.html @@ -13,7 +13,7 @@

Partyhatwork animation configurator

Animation information

- Name (valid c++ variable name):
+

Active LEDs


@@ -27,6 +27,7 @@

Active LEDs

Mode flags

+
@@ -39,6 +40,7 @@

Mode flags

+

Generated code

@@ -206,6 +208,42 @@

Generated code

} return false; }); + + + jQuery('#generatebutton').click(function(){ + animation_code = "const Animation "+jQuery('#animation_name').val()+" PROGMEM = {\n &next_animation_name,\n B"; + for (i = 7; i >= 0; i--) + { + if (jQuery('#led_'+i+'_enabled').filter(':checked').length) + { + animation_code += "1"; + } + else + { + animation_code += "0"; + } + } + animation_code += ",\n "+jQuery('#frames tbody tr').length+",\n "; + if (jQuery('#mode_fading').filter(':checked').length) + { + animation_code += "0x1,\n"; + } + else + { + animation_code += "0x0,\n"; + } + animation_code += " "+jQuery('#animation_name').val()+"_frames,\n};\n"; + + // TODO: Generate frame data too + + jQuery('#generated textarea').val(animation_code); + + // Scroll to and focus the textarea + jQuery('html, body').animate({ + scrollTop: jQuery('#generated').offset().top + }, 50); + jQuery('#generated textarea').focus(); + }); });