Add completed slit scanner
This commit is contained in:
@ -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/Week 13/13.2.15 Slit Scan/libraries/.DS_Store
vendored
Normal file
BIN
CM2030 Graphics Programming/Week 13/13.2.15 Slit Scan/libraries/.DS_Store
vendored
Normal file
Binary file not shown.
3
CM2030 Graphics Programming/Week 13/13.2.15 Slit Scan/libraries/p5.min.js
vendored
Normal file
3
CM2030 Graphics Programming/Week 13/13.2.15 Slit Scan/libraries/p5.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
28
CM2030 Graphics Programming/Week 13/13.2.15 Slit Scan/libraries/p5.sound.min.js
vendored
Normal file
28
CM2030 Graphics Programming/Week 13/13.2.15 Slit Scan/libraries/p5.sound.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,36 @@
|
||||
let video;
|
||||
let strip;
|
||||
let strips=[];
|
||||
let scan;
|
||||
|
||||
function setup() {
|
||||
createCanvas(640 * 2, 480);
|
||||
pixelDensity(1);
|
||||
video = createCapture(VIDEO);
|
||||
video.hide();
|
||||
scan = createGraphics(640, 480);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
background(150);
|
||||
image(video, 0, 0);
|
||||
|
||||
// STEP 1 - write your cocde below
|
||||
strip = video.get(video.width/2, 0, 1, video.height);
|
||||
// save to scan object
|
||||
scan.image(strip, frameCount%640 - 1, 0);
|
||||
// or store it in an array
|
||||
//strips[frameCount%640 - 1] = strip;
|
||||
|
||||
push();
|
||||
stroke(255, 0, 0);
|
||||
line(video.width / 2, 0, video.width / 2, video.height);
|
||||
pop();
|
||||
|
||||
// STEP 2 - write your code below
|
||||
// one of the two methods below will work
|
||||
|
||||
image(scan, 640, 0);
|
||||
//for(let i=0; i<strips.length; i++)
|
||||
// image(strips[i], 640 + i, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user