• fullscreen
  • sketch_jan15a.pde
  • word.pde
  • import traer.physics.*;
    
    ParticleSystem physics;
    Particle points;
      Word w,w2,w3,w4;
    void setup()
    {
      size(600,600,P3D);
     
    physics = new ParticleSystem(0,0.05);
    //w = new Word("Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! ",physics);
    w = new Word("Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words ! Follow my words !",physics);
    frameRate(30);
    background(0);
    }
    
    void draw()
    {
      fill(255,80);
      rect(0,0,width,height);
    //  background(255);
      w.update();
      w.draw();
      physics.tick();
    }
    
    
    import traer.physics.*;
    class Word {
      ParticleSystem physics;
      Particle[] lettersParticules;
      Spring[] lettersSpring;
      String wordString;
      //char[] charArray;
      float xPos;
      float yPos;
      int nbLetters;
      PFont font;
    
      Word(String wstr,ParticleSystem ps) {
        wordString = wstr;
        nbLetters = wordString.length();
        physics = ps;
    
        // The font must be located in the sketch's 
        // "data" directory to load successfully
        font = loadFont("DejaVuSerifCondensed-48.vlw");  
        xPos = random(width);
        yPos = random(height);
        lettersParticules = new Particle[nbLetters];
        lettersSpring = new Spring[nbLetters];
        boolean firstTime=true;
        for(int i=0;i<nbLetters;i++)
        {
          xPos = width/2;//random(width);
          yPos = height/2;//random(height);
    
          lettersParticules[i] = physics.makeParticle(10,xPos,yPos,0.0);
          if(!firstTime)
          {
            lettersSpring[i] = physics.makeSpring( lettersParticules[i], lettersParticules[i-1], 1.2, 0.1, 10);
            //physics.makeAttraction(lettersParticules[i] , lettersParticules[i-1], -200 , -100 );
          }
          else
          {
            firstTime=false;
          }
        }
        lettersParticules[0].makeFixed();
      }
      void draw()
      {
        fill(#0000ff,90);
        for(int i=0;i<nbLetters;i++)
        {
          textFont(font, 18+i/10.0);
          text(wordString.charAt(nbLetters-i-1),lettersParticules[i].position().x(),lettersParticules[i].position().y());
        }
      }
      void update()
      {
        for(int i=0;i<nbLetters;i++)
        {
          if(lettersParticules[i].position().y() > height)
          {
            lettersParticules[i].velocity().set(lettersParticules[i].velocity().x(),-abs(lettersParticules[i].velocity().y()),lettersParticules[i].velocity().z());
          }
          if(lettersParticules[i].position().x() > width)
          {
            lettersParticules[i].velocity().set(-abs(lettersParticules[i].velocity().x()),lettersParticules[i].velocity().y(),lettersParticules[i].velocity().z());
          }
    
          ;
        }
        //lettersParticules[0].position().set( width-frameCount*2,height/2, 0);
    lettersParticules[0].position().set(mouseX+30*cos(radians(frameCount*15)),mouseY+30*sin(radians(frameCount*15)), 0);
        //lettersParticules[0].setX(mouseX);
        //lettersParticules[0].setY(mouseY);
      }
    }
    
    

    code

    tweaks (0)

    about this sketch

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

    license

    advertisement

    Sad Eden

    Follow my words ! 2

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

    Made with Traer.physics.
    Hust move your mouse over.

    You need to login/register to comment.