I am using Inkscape to make a plan, and showing it in a widget. I am able to switch lights and so, and change the icons. So far so good.
I wonder, if its possible to change the elements within the SVG with java. If you set the ID of the object within Inkscape, would you be able to get the elementID from java, and change color, placement, width, length and so dynamically?
Usefull for eg:
Place the sun over my home acording to time of day
Having simple graphic bars showing temp/lux or similar
Show dimming values of lights as a bar
Anyone done this? Examples would be much apreciated.
Or maybe there is a different way of doing this?
Or maybe its not possible at all. I would like to avoid using 101 icons to show from 0-100% of something graphically
Yes. I have a habpanel widget, that is mainly one big SVG. I lazy load a js script, css and svg.
And I would like to script this SVG from Hus.js, to make animations, when an event occur. But that means, that I have to catch these events, when a state changes. I do already have access to the items, but it would be nice to detect when they change, and only act upon changes.
I think the best way to get it done would be with ngStyle if possible - you can specify an object in your scope and use expressions involving itemState() etc. (example), it should be reactive to changes.
If you really want to subscribe to events though in a standard way, this is possible - inject OHService in your controller and use OHService.onUpdate like this: