Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //save visuals to screenshots in file folder
- //save mousepositions to txt file
- float circleX, circleY;
- String[] positions;
- String[] savedPositions;
- void setup()
- {
- size(300,300);
- smooth();
- circleX=0;
- circleY=0;
- positions = new String[0];
- savedPositions = loadStrings("positions.txt");
- frameRate(30);
- }
- void draw()
- {
- background(0);
- fill(255);
- noStroke();
- ellipse(width/2,height/2, 150,150);
- stroke(0);
- strokeWeight(3);
- pushMatrix();
- translate(width/2, height/2);
- rotate(map(mouseY, 0, height, 0, PI));
- line(0,0, 0,60);
- popMatrix();
- fill(128);
- String coordinateString = savedPositions[frameCount%savedPositions.length];
- int[] coordinateNumbers = int(split(coordinateString, ","));
- ellipse(coordinateNumbers[0], coordinateNumbers[1], 50,50);
- fill(255);
- stroke(0);
- ellipse(circleX, circleY, 50, 50);
- }
- void mouseMoved()
- {
- circleX=mouseX;
- circleY=mouseY;
- positions = append(positions, mouseX + "," + mouseY);
- }
- void keyPressed()
- {
- if(key == ' ')
- {
- //saves screenshot on each keypress
- // saveFrame("frame-####.png");
- //saves mouse coordinates to a txt file from array ofray of coordinates on each keypress
- saveStrings("positions.txt", positions);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement