Update completed
This commit is contained in:
15
CM2030 Graphics Programming/Topic 6/6.3.1 2DNoise/index.html
Normal file
15
CM2030 Graphics Programming/Topic 6/6.3.1 2DNoise/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>graphicsProgramming - Coursera</title>
|
||||
<script src="libraries/p5.min.js" type="text/javascript"></script>
|
||||
<script src="libraries/p5.sound.min.js" type="text/javascript"></script>
|
||||
|
||||
<script src="sketch.js" type="text/javascript"></script>
|
||||
|
||||
<style> body {padding: 0; margin: 0;} canvas {vertical-align: top;} </style>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
BIN
CM2030 Graphics Programming/Topic 6/6.3.1 2DNoise/libraries/.DS_Store
vendored
Normal file
BIN
CM2030 Graphics Programming/Topic 6/6.3.1 2DNoise/libraries/.DS_Store
vendored
Normal file
Binary file not shown.
3
CM2030 Graphics Programming/Topic 6/6.3.1 2DNoise/libraries/p5.min.js
vendored
Normal file
3
CM2030 Graphics Programming/Topic 6/6.3.1 2DNoise/libraries/p5.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
28
CM2030 Graphics Programming/Topic 6/6.3.1 2DNoise/libraries/p5.sound.min.js
vendored
Normal file
28
CM2030 Graphics Programming/Topic 6/6.3.1 2DNoise/libraries/p5.sound.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
39
CM2030 Graphics Programming/Topic 6/6.3.1 2DNoise/sketch.js
Normal file
39
CM2030 Graphics Programming/Topic 6/6.3.1 2DNoise/sketch.js
Normal file
@ -0,0 +1,39 @@
|
||||
//////////////////////////////////////////////////
|
||||
// COURSERA GRAPHICS PROGRAMMING
|
||||
//////////////////////////////////////////////////
|
||||
function setup() {
|
||||
createCanvas(200, 200);
|
||||
background(0);
|
||||
rectMode(CENTER);
|
||||
}
|
||||
//////////////////////////////////////////////////
|
||||
function draw() {
|
||||
background(0);
|
||||
|
||||
//randomGrid();
|
||||
|
||||
noiseDetail(map(mouseY, 0, height, 0, 5));
|
||||
noisyGrid();
|
||||
}
|
||||
///////////////////////////////////////////////////
|
||||
function randomGrid(){
|
||||
for (var x=0; x<width; x+=1){
|
||||
for (var y=0; y<height; y+=1){
|
||||
var c = random(0, 255);
|
||||
stroke(c)
|
||||
point(x, y);
|
||||
}
|
||||
}
|
||||
noLoop();
|
||||
}
|
||||
///////////////////////////////////////////////////
|
||||
function noisyGrid(){
|
||||
for (var x=0; x<width; x+=1){
|
||||
for (var y=0; y<height; y+=1){
|
||||
var n = noise(map(mouseX, 0, width, x/10, x/100), map(mouseX, 0, width, y/10, y/100));
|
||||
var c = map(n, 0, 1, 0, 255);
|
||||
stroke(c)
|
||||
point(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user