Js Raphael object.animate调用不起作用

问题描述

嗨,我是Js的新手,我正在用Raphael库对对象进行一些简单的移动,但是我的其中一个功能不能正常工作,即使可以。

下面是一些代码

z=(float) ( (unsigned)(-10)*25 ) = (float) (4294967286 x 25) = (float) 107374182150

功能

/*Moving Objects*/
    var mainBall = paper.circle(650,340,30);

    var mainRect = paper.rect(430,310,50,50);

    
    /*Moving Object attributes*/
    mainBall.attr({fill:"45-purple-yellow"});

    mainRect.attr({fill:"45-purple-yellow"});

我这样称呼他们

function leavePipeB1(){

        mainBall.animate({cx:550,cy:340},1200,"linear",ball1ToMagnet);

    }

    function ball1ToMagnet(){

        mainBall.animate({cx:130,cy:115},1300,"elastic",showRect);

    }

    function leavePipeR1(){

        mainRect.animate({cx:550,"linear");

    }

    function hideBall(){

        tempBall.hide();
    }

    function hideRect(){

        tempRect.hide();
    }

    function hideEll(){

        tempEll.hide();
    }

    function showRect(){

        tempRect.show();
    }

但是LeavePipeR1()不起作用。

有什么办法可以解决这个问题?

解决方法

这是因为Rect没有cx,cy属性。将它们替换为x,y。