Actionscript:
-
stage.frameRate = 30;
-
var footA:MovieClip = makeFoot(0);
-
var footB:MovieClip = makeFoot(Math.PI);
-
-
addEventListener(Event.ENTER_FRAME, onLoop);
-
function onLoop(evt:Event):void {
-
graphics.clear();
-
graphics.lineStyle(0,0x000000);
-
graphics.moveTo(footA.x, footA.y);
-
graphics.curveTo(footA.x + 20, footA.y - 50, 200, 100);
-
graphics.curveTo(footB.x + 20, footB.y - 50, footB.x, footB.y);
-
}
-
-
function makeFoot(startAngle:Number):MovieClip {
-
var mc:MovieClip = MovieClip(addChild(new MovieClip()));
-
with(mc.graphics) beginFill(0x000000), curveTo(10,-10, 20, 0);
-
mc.x = 200;
-
mc.y = 200;
-
mc.sx = mc.x;
-
mc.sy = mc.y;
-
mc.t = startAngle;
-
mc.r = 50;
-
mc.addEventListener(Event.ENTER_FRAME, onRunFoot);
-
return mc;
-
}
-
function onRunFoot(evt:Event):void {
-
var mc:MovieClip = MovieClip(evt.currentTarget);
-
with(mc){
-
x = sx + r * Math.cos(t);
-
y = Math.min(sy, sy + r * Math.sin(t));
-
rotation = sy - y;
-
t += .15;
-
}
-
}
This is a funny looking snippet that creates a very primitive walk cycle with the Graphics class and sine and cosine.