Hi Pierre Hébert​

Hi Pierre Hébert​

I am playing around with the SVG-stuff. But I cannot make it do what I want in Binding. My script works fine.

Here is the SVG:

http://www.w3.org/2000/svg” xmlns:xlink=”http://www.w3.org/1999/xlink

viewBox=”0 0 99 99″ style=”enable-background:new 0 0 99 99;” xml:space=”preserve”>

d=”M50,5 c-20,100 20,100 0,0″/>

Here is the working Script :

var s = getEvent().getItem().getBoxBackground(‘n’).getSvgRoot().getElementById(‘hand’)

if (s.getTransform() == null)

{ s.setTransform(‘rotate(33 -50 -60)’)}

else

{ s.setTransform(”)}

But as the photo shows, it will not rotate wirh bindings. But the binding-options for the SVG #hand do populate.

Any suggestions?

]]>

16 Commentsto Hi Pierre Hébert​

  1. Anonymous says:

    < ![CDATA[

    Extra info, picture shows error.


    I did try with quotes around the binding-script but that does not work


    https://lh3.googleusercontent.com/5UcTBddfrRPzvNSbNiu0h4PIOsVcs_xnwAeFKSpArQBM6AXugGeGHvtQNjyzj5YtxOfp-M9GzQ

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Sorry if this is a bit off topic, but how do you set a svg image in the first place?


    When I go to the bindings property list I don’t see the svg entry, so I guess I need to set it first somehow.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Like you set an image background but you choose an svg 😉

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Oooooh! You can save the svg text and it can be loaded inside lighting!


    But it needs to be chosen with an external explorer, lighting’s one doesn’t show it (with .svg extension).


    Thank you! Now I can play with it, and I’ll use your example, so if I discover something about your problem I’ll tell you.

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Didn’t know LL-default picker does not show svg 🙂 🙂 see my other post 😉

    ]]>

  6. Anonymous says:

    < ![CDATA[

    It seems the binding is expecting a string. This works for me 🙂



    ‘rotate(‘+($ll_second*6)+’ -50 -60)’

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Extra quotes THANKS

    ]]>

  8. Anonymous says:

    < ![CDATA[

    The SVG needs tuning to be usable as seconds.


    Hint: tune the 100 and not the 99. Else rotation point needs tuning too.

    ]]>

  9. Anonymous says:

    < ![CDATA[

    Pierre Hébert​ the initial help-request is solved but…


    The given example gives a blurry result when the item is stretched to 2×2 cells. This is why people use svg because you should never get a blurry result with svg. When i alter the viewbox to 999×999 it is sharp again.


    I know this is first beta with svg.

    ]]>

  10. Anonymous says:

    < ![CDATA[

    Pierre Hébert do the SVG-bindings get all the update-cycles?

    ]]>

  11. Anonymous says:

    < ![CDATA[

    In theory yes, but it’s bound by the redraw speed and the maximum refresh rate (60Hz). The SVG above should be fast to draw.


    Regarding the viewbox, it is used as an hint for bitmap size. The reason is that with android hardware accelerations, everything has to be rendered into a bitmap as some point.

    ]]>

  12. Anonymous says:

    < ![CDATA[

    I meant for using my own variables (wind direction). After a restart it will point up. I need to go into edit-mode to make it point the right way. Even with the ‘dummy-workaround’




    Svg transform :



    dummy = $ll_minute


    return ‘rotate(‘+$owm_forcast_0_wdeg+’ -50 -50)’

    ]]>

  13. Anonymous says:

    < ![CDATA[

    So there’s probably an issue where the binding is evaluated but not applied at startup. I guess it will be applied only after one minute then? (unless you enter edit mode before)

    ]]>

  14. Anonymous says:

    < ![CDATA[

    Ofcourse I waited 5 minutes the first few times. And tried the $ll_second too. But it will not rotate 🙁

    ]]>

  15. Anonymous says:

    < ![CDATA[

    Using ‘rotate(‘+($ll_second*6)+’ -50 -50)’ seems to work for me in a minimal setup.


    By the way there’s a bug with how cx and cy are handled in the rotation, it’s inverted and should be 50/50, not -50/50.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *