Logic Machine Forum
Font Text - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Font Text (/showthread.php?tid=5287)



Font Text - Amelie - 07.03.2024

I have a group dress which can have a value between 12 and 71. Let call it groupadress A. On my visualization, I have an object (other group adress), groupadress B.

Can I change the font of B on the visualization, based on the value of A?


RE: Font Text - Erwin van der Zwart - 07.03.2024

Something like this should do the trick, give your button a custom class (mycustomclass in this sample)

Code:
$(function(){
  if (typeof grp != 'undefined') {
    grp.listen('1/5/1', function(object, state) {
      if (state == 'value') {
        if (object.value == true) {
          $(".mycustomclass .value").css({"font-family":"Arial, Helvetic, Sans-Serif", "font-size":"300%", "color":"#c0ba2c"});
        } else {
          $(".mycustomclass .value").css({"font-family":"Fantasy", "font-size":"200%", "color":"#c35e1e"});
        }
      }
    }, true);
  }
});



RE: Font Text - admin - 08.03.2024

Here's a working example:
Code:
$(function() {
  if (window.grp) {  
    grp.listen('32/1/2', function(object, state) {
      var size = Math.max(12, object.value);
      $('.size').css('font-size', size + 'px');
    });
  }
});

32/1/2 is the groups address that sets the size. size is the Additional class of the element where font size should be changed dynamically.


RE: Font Text - Amelie - 11.03.2024

Thans you very much.

Every time, I am amazed by what is possible with LM. Such a small device with so many possibilities!