【发布时间】:2011-06-14 05:43:13
【问题描述】:
我想要一个移动的图像和一个移动的文本。因此,当我移动图像时,文本也随之移动!我该怎么做呢?我已使用此代码使图像移动,但如何添加文本?
var R = Raphael("hello_world", 800, 800),
elipse = R.image("mioo.jpg",100,200,100,300);
var start = function () {
this.ox = this.attr("x");
this.oy = this.attr("y");
this.animate({r: 70, opacity: .25}, 500, ">");
},
move = function (dx, dy) {
this.attr({x: this.ox + dx, y: this.oy + dy});
},
up = function () {
this.animate({r: 50, opacity: .5}, 500, ">");
};
elipse.drag(move, start, up);
【问题讨论】:
-
请使用 { } 按钮格式化代码。这次我已经为你做到了。
-
但是@angel 请不要重复。改为编辑您现有的问题,以便将其放到首页。
标签: javascript image project raphael