Snap SVG围绕某个点旋转元素

时间:2016-05-02 13:34:06

标签: javascript animation svg rotation snap.svg

我在SVG中有轮盘赌和球。轮盘旋转,我想围绕轮盘赌中心旋转球。但它围绕其他点旋转。如何围绕轮盘中心旋转?

var bbox = ballg.getBBox(); //bounding box, get coords and centre
var scale = 2.85;
var off = 10;
ballAnimation(bbox.cx + off, bbox.cy + off, 3000, scale);

function ballAnimation(cx, cy, speed, scale){
    ballg.attr({ transform: 'r0 ' + cx + ' ' + cy + " s" + scale + "," + scale + "," + cx + "," + cy }); //Reset + Scale setup
    ballg.stop(true).animate(
        { transform: "r360," + cx + ',' + cy + " s" + scale + "," + scale + "," + cx + "," + cy },
        speed,
        function(){
            ballAnimation(cx,cy, speed, scale);
        }
    );
}

When Documents Become Databases – Tabulizer R Wrapper for Tabula PDF Table Extractor

0 个答案:

没有答案