svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
10.95k stars 1.07k forks source link

rotation is not working properly when we need multiple angles.. #1276

Closed patson12 closed 10 months ago

patson12 commented 1 year ago

Bug report

i am working on guage .. needle is not rotating correctly .. it works like if first rotate angle is 30 then needle goes to 30 degree then next value is 50 then it starts from 30 angle and goest to 30+50= 80 and so on. no getting it exact angle..i have fixed centerx and centery point ..rotation is not working properly exactly it should be..

Fiddle

https://jsfiddle.net/harshadpatson/vjzywu1d/10/

Explanation

angle is not working if there is multiple angle.. new angle is added in old and so .. on

Fuzzyma commented 1 year ago

Try .transform({ rotate: angle, originX: centerX, originY: centerY}) instead. However, your center is way off so it still looks strange