Blindeagle
Blindeagle

Reputation: 91

raphael how to move text

I have some text and I want to move it up using the Raphael library. However is there also a way of moving it up after 3 seconds or something like that.

var t1 = paper.text(700, 168, "Hi");
t1.attr({fill:"white"});

I tried to use this code so that it would move the text up however it did not.

t1.animate({cy: 10 , cx: 700}, 10000);

I just wanted to ask the same thing for the curve path.

        var curvePath = paper.path("M690,124s20,15 10,19Z");
    curvePath.attr({fill:"orange"});

And i have tried the same thing but i guess i got wrong things again.

    curvePath.animate({m: 10 , z: 700}, 10000);

Thanks again for all the help.

Upvotes: 3

Views: 880

Answers (1)

Jashwant
Jashwant

Reputation: 28995

In place of,

t1.animate({cy: 10 , cx: 700}, 10000);

Use this,

t1.animate({y: 10 , x: 700}, 10000);

Paper has x and yattributes , not cx and cy.

Reference

Edit (after comment):

From the same reference, I've given

var t1 = paper.text(700, 168, "Hi");
t1.attr({fill:"white"});
var anim = Raphael.animation({y: 10 , x: 700}, 10000)
t1.animate(anim.delay(5000));   // animation will start after 5 seconds.

Upvotes: 3

Related Questions