• fullscreen
  • spiral.pde
  • boolean button = false;
    float a = 0;
    float b = 5;
    float angle = 0;
    void setup () {
      size(800, 600);
      background(255);
      frameRate(15);
    }
    void draw() {
      stroke(mouseX-100, mouseY-100, mouseX, mouseY);
      translate(width/2, height/2);
      rotate (radians(angle));
      if (keyPressed) {
        line(-75, 10, a, b);
        line(75, -10, a, b);
      } else line(75, -10, a, b);
      if (mousePressed) {
        button = !button;
      }
      if (button) {
        background(255);
        a = 0;
        b = 5;
        angle = 0;
        line(75, -10, a, b);
      }
      angle += (50);
      a += 0.1;
      b += 0.5;
     }
    

    code

    tweaks (0)

    about this sketch

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

    license

    advertisement

    Lib4tech

    Spiral stars

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

    Another simple beginner's sketch produced while I experimented with the rotate function. Move mouse to change colour and opacity of lines, press any key to have two lines to form star-like shape, and click mouse to start again.

    You need to login/register to comment.