Earthworm!

i made an earthworm effect out of purecode
make sure you set the framerate to 50 fps
edit things like fbseparation which says the distance between the front and back of the worm and maxcurve which says the maximum amount of curve the earthworm can have and maxinterval which says the amount of time between the full movements of the worm.


fbseparation = 40;
separation = 15;
bspot = 0;
fspot = bspot+fbseparation;
maxinterval = 30;
interval = maxinterval;
maxcurve = 50;
_root.createEmptyMovieClip("back", 1);
_root.createEmptyMovieClip("front", 2);
_root.createEmptyMovieClip("middle", 3);
_root.createEmptyMovieClip("curve", 4);
setbspot = function () {
    bspot += fbseparation;
    cspot -= maxcurve;
};
setfspot = function () {
    fspot += fbseparation;
    cspot += maxcurve;
};
with (back) {
    beginFill(0xFF99CC, 80);
    lineStyle(5, 0x000000, 100);
    lineTo(15, 0);
    lineStyle(5, 0x000000, 0);
    lineTo(15, 15);
    lineStyle(5, 0x000000, 100);
    lineTo(0, 15);
    lineTo(0, 0);
    _y += 100;
}
with (front) {
    beginFill(0xFF99CC, 80);
    lineStyle(5, 0x000000, 100);
    lineTo(15, 0);
    lineTo(15, 15);
    lineTo(0, 15);
    lineStyle(5, 0x000000, 0);
    lineTo(0, 0);
    _y += 100;
}
cspot = front._y-maxcurve;
onEnterFrame = function () {
    fbseparation += .25;
    if (front._x>550 && back._x>550) {
        front._x = -15;
        fspot = -15;
        back._x = -fbseparation-15;
        bspot = -fbseparation-15;
    }
    interval -= 1;
    if (interval == maxinterval/2) {
        setfspot();
    }
    if (interval == 0) {
        setbspot();
        interval = maxinterval;
    }
    if (front._x != fspot) {
        front._x += (fspot-front._x)/5;
    }
    if (back._x != bspot) {
        back._x += (bspot-back._x)/5;
    }
    if (curve._y != cspot) {
        curve._y += (cspot-curve._y)/5;
    }
    curve._x = (front._x+back._x+15)/2;
    with (middle) {
        clear();
        beginFill(0xFF99CC, 80);
        lineStyle(5, 0x000000, 100);
        moveTo(back._x+15, back._y);
        curveTo(_root.curve._x, _root.curve._y, front._x, front._y);
        lineStyle(5, 0x000000, 0);
        lineTo(front._x, front._y+_root.separation);
        lineStyle(5, 0x000000, 100);
        curveTo(_root.curve._x, _root.curve._y+_root.separation, back._x+15, back._y+_root.separation);
        lineStyle(5, 0x000000, 0);
        lineTo(back._x+15, back._y);
    }
};

the worm gets longer over time. to edit that feature out, take out line 43
swf:
http://img471.imageshack.us/my.php?image=earthworm7ep.swf

aww i thought it was pretty cool but i guess no one else does

… its cool its just when would it fit into a site?

… just make like 100 of them going accross the screen and it will be better.

Yeah, it’s a cool novelty. It sounds strange, but the other day I was scooting strip of paper around like an inch wormand thinking, hmmm . . . how would you animate something like that in Flash. Well, now I know.

it’s a cool effect no doubt. maybe you can extend it by making it (like a top view) go around from random to random place on the stage?

good work nonetheless.

Nice piece of code…:A+: