• fullscreen
  • Wormy.pde
  • int maxBodys = 115;// how many ellipse are on screen at once
    int currW =0;// used for counting purposes
    PVector[] pos = new PVector[maxBodys];//an array of positions
    void setup() {
      size(600,600);//you should know what this is
      noStroke();//no stroke works in the setup
      for(int i=0; i< maxBodys; i++) {//this is where we creat the positions
        pos[i] = new PVector(300,300);
      //the optional smooth function
     // smooth();
    void draw() {
      background(0);// black and boring, but it works for me
      //and these are the worms
      worm(mouseX, mouseY,20);
      worm(sin(radians(frameCount)) * 250 +300,cos(radians(frameCount)) * 150 +300,20);
      worm(sin(radians(frameCount+180)) * 250 +300,cos(radians(frameCount+180)) * 150 +300,20);
     //    math is used to make them go up and down
      worm(sin(radians(frameCount*10)) * 50 +300,sin(radians(frameCount -90)) * 300 +300,30);
      worm(sin(radians(frameCount +185)) * 350 +300,sin(radians(frameCount*10)) * 50 +300,25);
      currW =0;// DO NOT REMOVE is  very important
    void worm(float x, float y, int Wlength) { //the worm fuction
      // this keeps the program from crashing if you do something stupid
      if(currW +Wlength > maxBodys) Wlength = maxBodys - currW;
      for(int del=Wlength-1; del>-1; del--) {//now for some more math
        if(del >0) {
          pos[del +currW].x += (pos[del-1 +currW].x-pos[del +currW].x)/(del/Wlength +1);
          pos[del +currW].y += (pos[del-1 +currW].y-pos[del +currW].y)/(del/Wlength +1);
          fill(255,255 - del*10, sin(radians(frameCount)) * 250 - random(255));
          ellipse(pos[del +currW].x,pos[del +currW].y, 50 -del, 50 -del);
        else {
          pos[del +currW].x += (x-pos[del +currW].x)/(10);
          pos[del +currW].y += (y-pos[del +currW].y)/(10);
      currW += Wlength;// keeps other worms from stealing the same postions
    // I could have coded this better with a class. But I was too lazy.


    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.



    Report Sketch

    Report for inappropriate content

    Please provide details if possible:

    Your have successfully reported the sketch. Thank you very much for helping to keep OpenProcessing clean and tidy :)

    Make a Copyright Infringement claim

    Jeremy Green

    Wormy worms

    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    Its a bunch of radioactive worm things!

    You need to login/register to comment.