Closed alexer2019 closed 4 years ago
var draw = SVG('drawing').size(300, 300).addClass('svg'); var image = draw.image('image/emptyCar.png').size(32, 32).move(0,0); image.animate().dx(100); image.animate(1000, '-').rotate(90,100+16,16); image.animate().dx(200); image.animate(1000, '-').rotate(90,?,?);
question: where is the ?,? will be???? I am refused...
I want to rotate the image by its center
Get the bbox of the image by calling bbox() (and getting .cx and .cy of it) and use that. Or just do the math. You moved by 300x so the center is probably at 150 + 16x
var draw = SVG('drawing').size(300, 300).addClass('svg'); var image = draw.image('image/emptyCar.png').size(32, 32).move(0,0); image.animate().dx(100); image.animate(1000, '-').rotate(90,100+16,16); image.animate().dx(200); image.animate(1000, '-').rotate(90,?,?);
question: where is the ?,? will be???? I am refused...