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:
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?
< ![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
]]>
< ![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.
]]>
< ![CDATA[
Like you set an image background but you choose an svg 😉
]]>
< ![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.
]]>
< ![CDATA[
Didn’t know LL-default picker does not show svg 🙂 🙂 see my other post 😉
]]>
< ![CDATA[
It seems the binding is expecting a string. This works for me 🙂
‘rotate(‘+($ll_second*6)+’ -50 -60)’
]]>
< ![CDATA[
Extra quotes THANKS
]]>
< ![CDATA[
The SVG needs tuning to be usable as seconds.
Hint: tune the 100 and not the 99. Else rotation point needs tuning too.
]]>
< ![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.
]]>
< ![CDATA[
Pierre Hébert do the SVG-bindings get all the update-cycles?
]]>
< ![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.
]]>
< ![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)’
]]>
< ![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)
]]>
< ![CDATA[
Ofcourse I waited 5 minutes the first few times. And tried the $ll_second too. But it will not rotate 🙁
]]>
< ![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.
]]>
< ![CDATA[
Only after going into edit on the svg binding , it will rotate.
https://lh3.googleusercontent.com/amlZ6lpOKomqW3ylBpdNt8H_ruAlwiYFtpceSZMvL_joj8prLM4VIzXbnaHKtV3AX0D3pkIu3g
]]>