
Код AS3:
var dir = 5;//скорость морфинга
var rectWidth = 200;
var ellipse = 0;
var shape = new Shape();
addChild(shape);
addEventListener(Event.ENTER_FRAME, morph);
function morph(event){
shape.graphics.clear();
shape.graphics.lineStyle(1, 0, 1);
shape.graphics.beginFill(0xFF0000, 1);
shape.graphics.drawRoundRect(0, 0, rectWidth, rectWidth, ellipse, ellipse);
ellipse += dir;
if (dir > 0 ) if (ellipse > rectWidth) dir = -dir;
if (dir < 0 ) if (ellipse == 0) dir = -dir;
}