• fullscreen
  • first.pde
  • float mx;
    float my;
    float easing;
    int index;
    float[] xPoints;
    float[] yPoints;
    float rotate;
    float scale;
    float translateX;
    float translateY;
    
    void setup()
    {
        size( 700, 400 );
        smooth();
        easing = .015;
        index = 0;
        xPoints = new float[4];
        yPoints = new float[4];
        translateX = width/2;
        translateY = height/2;
    }
    
    void draw()
    {
        rotate(rotate);
        scale(scale);
        translate(translateX, translateY);
        mx += easing*(mouseX - mx);
        my += easing*(mouseY - my);
        
        background( 0, 0, 0, 10 );
        stroke( 255, 0, 0, 70 );
    
        for( float i = 0; i < 4; i += .3 )
        {
            line( xPoints[0], yPoints[0], mx - mx*i, my - my*i );
            line( xPoints[2], yPoints[2], mx - mx*i, my - my*i );
            line( xPoints[1], yPoints[1], mx - mx*i, my - my*i );
            line( xPoints[3], yPoints[3], mx - mx*i, my - my*i );
            line( xPoints[0], yPoints[0], mx + mx*i, my + my*i );
            line( xPoints[2], xPoints[2], mx + mx*i, my + my*i );
            line( xPoints[1], xPoints[1], mx + mx*i, my + my*i );
            line( xPoints[3], xPoints[3], mx + mx*i, my + my*i );
            line( xPoints[0], xPoints[0], mx*i, my*i );
            line( xPoints[2], xPoints[2], mx*i, my*i );
            line( xPoints[1], xPoints[1], mx*i, my*i );
            line( xPoints[3], xPoints[3], mx*i, my*i );
        }
        
    }
    
    void mouseClicked()
    {
        xPoints[index] = mouseX;
        yPoints[index] = mouseY;
        index = (1 + index) % xPoints.length;
        rotate += .1;
        scale = random( 4 );
        translateX -= 10;
        translateY -= 10;
    }
    

    code

    tweaks (0)

    about this sketch

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

    license

    advertisement

    tacit dynamite

    nintendo virtual boy

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

    click to begin. move mouse around to affect the easing. click to add an anchor point. if you're careful, it won't fly off the screen.

    tacit dynamite
    7 Nov 2008
    PS to everybody - you might need to click a few times to get the thing to appear on the screen. Best of luck to you all.
    You need to login/register to comment.