IAT265 Picture Frame Example.docx

3 Pages
85 Views

Department
Interactive Arts & Tech
Course Code
IAT 265
Professor
Matt Lockyer

This preview shows page 1. Sign up to view the full 3 pages of the document.
Description
Picture Frame Main import controlP5.*; ControlP5 controlP5; PictureFrame frame; SlideShowFrame sFrame; void setup(){ size(800, 600); controlP5 = new ControlP5(this); // create a picture frame frame = new PictureFrame(100, 100, "picture1.jpg"); sFrame = new SlideShowFrame(400, 100, "picture1.jpg"); sFrame.addImage("picture2.jpg"); sFrame.addImage("picture3.jpg"); //add controls controlP5.addButton("next", 600, 400, height - (19 + 10), 80, 19); } void draw(){ background(128); frame.draw(); sFrame.draw(); } void controlEvent(ControlEvent e){ if(e.isController()){ if(e.controller().name() == "next"){ sFrame.nextImage(); } } } Picture Frame class PictureFrame{ // define the fields PImage image; PVector position; int frameWidth; PictureFrame(int xPos, int yPos, String imageString){ // initialize the fields image = loadImage(imageString); position = new PVector(xPos, yPos); frameWidth = 10; } void draw(){ //move the frame into position pushMatrix(); translate(position.x , position.y); //draw the frame noStroke(); fill(255); rect(0, 0, image.width + 2 * frameWidth, image.height + 2 * frameWidt
More Less
Unlock Document

Only page 1 are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit