xxxxxxxxxx
99
/*
Enzo Finegold
Final Project Proposal
5.1.24
*/
var currentSlide = 1;
var totalSlides = 4;
var nextSlideActive = false;
var prevSlideActive = false;
var projectDescription = 'My final project will be a combination of 2 previous projects: Assignment 8: Windows, and Assignment 9: Generative landscape. The code will create a new grid of different designed windows every time it runs.'
var interactionDescription = 'The user will be able to click "regenerate" and a new set of windows will appear.'
var graphics;
function preload() {
graphics = loadImage('window.jpg');
}
function setup() {
createCanvas(400, 400);
textFont('courier new');
}
function draw() {
background(220);
fill('black')
// Slide 1
if (currentSlide == 1) {
textAlign(CENTER, CENTER);
textSize(35);
text('My Final Project', width / 2, height / 2 - 20);
textSize(30);
text('By Enzo Finegold', width / 2, height / 2 + 60);
}
// Slide 2
if (currentSlide == 2) {
textAlign(LEFT, TOP);
textSize(21)
text(projectDescription, 50, 50, 300);
}
// Slide 3
if (currentSlide == 3) {
textSize(30);
text(interactionDescription, 50, 50, 300);
}
// Slide 4
if (currentSlide == 4) {
image(graphics, 0, 0);
graphics.resize(400, 350);
textAlign(CENTER, CENTER);
textSize(20)
text('Graphics', width / 2, height / 2 - 185);
}
// Next Button
nextSlideActive = button(300, 360, 60, 20, 'Next');
// Prev Button
prevSlideActive = button(50, 360, 60, 20, 'Prev');
}
function mousePressed() {
if (nextSlideActive && currentSlide < totalSlides) {
currentSlide += 1;
}
if (prevSlideActive && currentSlide > 1) {
currentSlide -= 1;
}
}
function button(x, y, w, h, txt) {
var isActive = false;
if (mouseX > x && mouseX < x + w && mouseY > y && mouseY < y + h) {
isActive = true;
fill('lightblue')
} else {
fill ('white')
}
rect(x, y, w, h);
textSize(h);
textAlign(LEFT, TOP)
fill('black')
text(txt, x + 5, y);
// Return button state to main program
return isActive;
}