Skip to content

Instantly share code, notes, and snippets.

@TRNT7
Created October 21, 2017 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TRNT7/d9452b27cb18d06dce9be07591cdde1f to your computer and use it in GitHub Desktop.
Save TRNT7/d9452b27cb18d06dce9be07591cdde1f to your computer and use it in GitHub Desktop.
var positions =[];
var Hello = {
you: "good",
weather: "today?",
status: undefined
};
function setup() {
createCanvas(windowWidth, windowHeight);
console.log(Hello);
}
function draw() {
background(0,20);
push();
translate(mouseX,mouseY);
rectMode(CENTER);
rect(0,0,70,70);
fill(42,171,229);
noStroke();
pop();
// draw of the achorded phidgets
for (var i = 0; i < positions.length; i++) {
push();
noStroke();
fill(positions[i].colour);
translate(positions[i].x, positions[i].y);
rotate(positions[i].rotation);
rect(0,0,positions[i].size, positions[i].size);
positions[i].rotation += positions[i].rotationrate;
pop();
}
}
function mouseClicked(){
var mousedata =
{
x : mouseX ,
y : mouseY,
size : 50,
rotation:0,
rotationrate: frameCount/70,
colour: "#F29DF2"
};
var now = new Date();
saveJSON(Hello, "Flowers"+ now);
positions.push(mousedata);
console.log(mousedata);
}
html>
<head>
<meta charset="UTF-8">
<!-- PLEASE NO CHANGES BELOW THIS LINE (UNTIL I SAY SO) -->
<script language="javascript" type="text/javascript" src="libraries/p5.js"></script>
<script language="javascript" type="text/javascript" src="SpinnerXjson.js"></script>
<!-- OK, YOU CAN MAKE CHANGES BELOW THIS LINE AGAIN -->
<!-- This line removes any default padding and style.
You might only need one of these values set. -->
<style> body {padding: 0; margin: 0;} </style>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment