This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Line lamp , light strip ,How to display with SVG or CSS?
#1
Line lamp , light strip ,How to display with SVG or CSS?
Reply
#2
First, create visuzalization elements for strip display. Set Display mode to icon and Additional classes to lights

Add this code to Custom JavaScript, change 32/1/1 to your color object value. It will remove icons from strip display elements and use current object color value as background fill with 50% opacity. You can change opacity from 0.5 to any other value between 1 and 0 if needed.

Code:
$(function(){
  if (typeof grp === 'object') {
    var lights = $('.lights');
        
    $.each(lights, function(_, el) {
      var light = $(el);

      light
        .css('width', light.width())
        .css('height', light.height())
        .css('opacity', 0.5)
        .find('.icon').remove();
    });
    
    grp.listen('32/1/1', function(obj) {
      lights.css('background-color', Scada.getRgbHex(obj.value));
    }, true);
  }
});
Reply
#3
Custom JavaScript will not work in the editor, try viewing visualization separately.
Reply
#4
I tried it and it works fine, probably your group 1/1/1 is not 3byte RGB
------------------------------
Ctrl+F5
Reply
#5
Yes, 1/1/1 is boolean since there are on and off icons in visualization element settings.
Reply
#6
(08.03.2019, 10:31)admin Wrote: Yes, 1/1/1 is boolean since there are on and off icons in visualization element settings.

Yes, my light bar is not RGB. group address Only open and close, but I also want to use CSS to show.


Looking at the yellow lines above my background image? I use the effect of wanting CSS.
Reply
#7
(08.03.2019, 13:47)newspaper Wrote:
(08.03.2019, 10:31)admin Wrote: Yes, 1/1/1 is boolean since there are on and off icons in visualization element settings.

Yes, my light bar is not RGB. group address Only open and close, but I also want to use CSS to show.


Looking at the yellow lines above my background image? I use the effect of wanting CSS.
If it is just 2 state they use 2 images for both state.
------------------------------
Ctrl+F5
Reply
#8
(04.03.2019, 08:41)admin Wrote: First, create visuzalization elements for strip display. Set Display mode to icon and Additional classes to lights

Add this code to Custom JavaScript, change 32/1/1 to your color object value. It will remove icons from strip display elements and use current object color value as background fill with 50% opacity. You can change opacity from 0.5 to any other value between 1 and 0 if needed.

Code:
$(function(){
 if (typeof grp === 'object') {
   var lights = $('.lights');
        
   $.each(lights, function(_, el) {
     var light = $(el);

     light
       .css('width', light.width())
       .css('height', light.height())
       .css('opacity', 0.5)
       .find('.icon').remove();
   });
   
   grp.listen('32/1/1', function(obj) {
     lights.css('background-color', Scada.getRgbHex(obj.value));
   }, true);
 }
});

My light strip are not RGB, only on and off. How to define the two colors on and off in the aboveCustom JavaScript , The group address is one bit.
Reply


Forum Jump: