Sbaw090526
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Sbaw090526

on

  • 2,463 views

 

Statistics

Views

Total Views
2,463
Views on SlideShare
1,781
Embed Views
682

Actions

Likes
1
Downloads
21
Comments
0

3 Embeds 682

http://yoppa.org 680
http://translate.googleusercontent.com 1
https://web.archive.org 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

Sbaw090526 Presentation Transcript

  • 1. #include quot;testApp.hquot; //-------------------------------------------------------------- void testApp::setup(){ } //-------------------------------------------------------------- void testApp::update(){ } //-------------------------------------------------------------- void testApp::draw(){ ofSetColor(31,63,255); ofCircle(mouseX, mouseY, 40); } ...( )...
  • 2. #include quot;testApp.hquot; //-------------------------------------------------------------- void testApp::setup(){ ofSetCircleResolution(128); ofBackground(0, 0, 0); ofSetColor(31,63,255); } //-------------------------------------------------------------- void testApp::update(){ } //-------------------------------------------------------------- void testApp::draw(){ ofCircle(mouseX, mouseY, 80); } //-------------------------------------------------------------- void testApp::exit(){ } //-------------------------------------------------------------- void testApp::mouseMoved(int x, int y ){ }
  • 3. //-------------------------------------------------------------- void testApp::mouseDragged(int x, int y, int button){ ofSetColor(255,63,31); } //-------------------------------------------------------------- void testApp::mousePressed(int x, int y, int button){ ofBackground(255, 255, 255); } //-------------------------------------------------------------- void testApp::mouseReleased(){ ofBackground(0, 0, 0); ofSetColor(31,63,255); } ...( )...
  • 4. #pragma once #include quot;ofMain.hquot; #include quot;ofxAccelerometer.hquot; #include quot;ofxMultiTouch.hquot; #define NUM 100 class testApp : public ofSimpleApp, public ofxMultiTouchListener { public: void setup(); void update(); void draw(); void exit(); ...( )... int ballCount; // ofPoint pressedPos; // ofPoint pos[NUM], speed[NUM]; // ofColor col[NUM]; // };
  • 5. #include quot;testApp.hquot; //-------------------------------------------------------------- void testApp::setup(){ ofEnableAlphaBlending(); ballCount = 0; pressedPos.x = 0; pressedPos.y = 0; } //-------------------------------------------------------------- void testApp::update(){ for(int i = 0; i < ballCount; i++){ pos[i].x += speed[i].x; pos[i].y += speed[i].y; if(pos[i].x<0 || pos[i].x>ofGetWidth()){ speed[i].x *= -1; } if(pos[i].y<0 || pos[i].y>ofGetHeight()){ speed[i].y *= -1; } } } //-------------------------------------------------------------- void testApp::draw(){ for(int i = 0; i < ballCount; i++){
  • 6. ofSetColor(col[i].r, col[i].g, col[i].b, 127); ofCircle(pos[i].x, pos[i].y, 20); } } //-------------------------------------------------------------- void testApp::exit(){ } //-------------------------------------------------------------- void testApp::mouseMoved(int x, int y ){ } //-------------------------------------------------------------- void testApp::mouseDragged(int x, int y, int button){ pos[ballCount-1].x = x; pos[ballCount-1].y = y; } //-------------------------------------------------------------- void testApp::mousePressed(int x, int y, int button){ ballCount++; if(ballCount > NUM){ ballCount = 1; } pos[ballCount-1].x = x; pos[ballCount-1].y = y; speed[ballCount-1].x = 0; speed[ballCount-1].y = 0;
  • 7. col[ballCount-1].r = ofRandom(0, 255); col[ballCount-1].g = ofRandom(0, 255); col[ballCount-1].b = ofRandom(0, 255); pressedPos.x = x; pressedPos.y = y; } //-------------------------------------------------------------- void testApp::mouseReleased(){ } //-------------------------------------------------------------- void testApp::mouseReleased(int x, int y, int button){ speed[ballCount-1].x = (x - pressedPos.x) * 0.1; speed[ballCount-1].y = (y - pressedPos.y) * 0.1; } ...( )...
  • 8. 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8
  • 9. #pragma once #include quot;ofMain.hquot; #include quot;ofxAccelerometer.hquot; #include quot;ofxMultiTouch.hquot; #define LENGTH 50 class testApp : public ofSimpleApp, public ofxMultiTouchListener { public: void setup(); void update(); void draw(); void exit(); ...( )... ofPoint pos[LENGTH]; };
  • 10. #include quot;testApp.hquot; //-------------------------------------------------------------- void testApp::setup(){ } //-------------------------------------------------------------- void testApp::update(){ // 1 for(int i = 1; i < LENGTH; i++){ // pos[LENGTH-i].x = pos[LENGTH-i-1].x; pos[LENGTH-i].y = pos[LENGTH-i-1].y; } // pos[0].x = mouseX; pos[0].y = mouseY; } //-------------------------------------------------------------- void testApp::draw(){ ofSetColor(31,63,255); // ofCircle(pos[LENGTH-1].x, pos[LENGTH-1].y, 40); }
  • 11. 0 1 2 3 4 5 6 7 8
  • 12. #pragma once #include quot;ofMain.hquot; #include quot;ofxAccelerometer.hquot; #include quot;ofxMultiTouch.hquot; #define NUM 8 // #define DELAY 20 // #define LENGTH NUM*DELAY // #define MAX_SIZE 400 // class testApp : public ofSimpleApp, public ofxMultiTouchListener { public: void setup(); void update(); void draw(); ...( )... // ofPoint pos[LENGTH]; };
  • 13. #include quot;testApp.hquot; //-------------------------------------------------------------- void testApp::setup(){ ofNoFill(); ofSetCircleResolution(128); ofSetColor(31,127,255); } //-------------------------------------------------------------- void testApp::update(){ // 1 for(int i = 0; i < LENGTH; i++){ pos[LENGTH-i].x = pos[LENGTH-i-1].x; pos[LENGTH-i].y = pos[LENGTH-i-1].y; } // pos[0].x = mouseX; pos[0].y = mouseY; }
  • 14. //-------------------------------------------------------------- void testApp::draw(){ // float size_div = MAX_SIZE / NUM; // // for(int i=0; i<NUM; i++){ ofCircle(pos[i*DELAY].x,pos[i*DELAY].y,size_div*(i+1)); } } ...( )...
  • 15. #pragma once #include quot;ofMain.hquot; #include quot;ofxAccelerometer.hquot; #include quot;ofxMultiTouch.hquot; class testApp : public ofSimpleApp, public ofxMultiTouchListener { public: void setup(); void update(); void draw(); void exit(); ...( )... ofPoint pos; float angle, radius, speed; };
  • 16. #include quot;testApp.hquot; //-------------------------------------------------------------- void testApp::setup(){ ofNoFill(); ofEnableAlphaBlending(); ofEnableSmoothing(); ofSetCircleResolution(64); ofSetColor(0, 0, 255); radius = 100; speed = 1; angle = 0; } //-------------------------------------------------------------- void testApp::update(){ pos.x = ofGetWidth()/2 + (radius * sin(angle * PI / 180.0)); pos.y = ofGetHeight()/2 + (radius * cos(angle * PI / 180.0)); angle += speed; } ...( )...
  • 17. #pragma once #include quot;ofMain.hquot; #include quot;ofxAccelerometer.hquot; #include quot;ofxMultiTouch.hquot; #define NUM 256 class testApp : public ofSimpleApp, public ofxMultiTouchListener { public: void setup(); void update(); void draw(); void exit(); ...( )... float angle[NUM]; float radius, maxSpeed, maxSize; };
  • 18. #include quot;testApp.hquot; //-------------------------------------------------------------- void testApp::setup(){ ofNoFill(); ofEnableAlphaBlending(); ofSetCircleResolution(256); ofSetColor(0, 0, 255, 127); radius = 80; maxSpeed = 0.25; maxSize = 80; for(int i = 0; i < NUM; i++){ angle[i] = 0; } } //-------------------------------------------------------------- void testApp::update(){ for(int i = 0; i < NUM; i++){ float thisSpeed = (maxSpeed / NUM) * i; pos[i].x = ofGetWidth()/2 + (radius * sin(angle[i] * PI / 180.0)); pos[i].y = ofGetHeight()/2 + (radius * cos(angle[i] * PI / 180.0)); angle[i] += thisSpeed; } }
  • 19. //-------------------------------------------------------------- void testApp::draw(){ for(int i = 0; i < NUM; i++){ float thisSize = (maxSize / NUM) * i; ofCircle(pos[i].x, pos[i].y, thisSize); } } //-------------------------------------------------------------- void testApp::exit(){ } //-------------------------------------------------------------- void testApp::mouseMoved(int x, int y ){ } //-------------------------------------------------------------- void testApp::mouseDragged(int x, int y, int button){ for(int i = 0; i < NUM; i++){ angle[i] += i * y / 100.0; } } ...( )...
  • 20. #pragma once #include quot;ofMain.hquot; #include quot;ofxAccelerometer.hquot; #include quot;ofxMultiTouch.hquot; #define NUM 5096 #define TOWPI PI * 2.0 class testApp : public ofSimpleApp, public ofxMultiTouchListener { public: void setup(); void update(); void draw(); void exit(); ...( )... ofPoint pos[NUM]; float counter, speed; };
  • 21. #include quot;testApp.hquot; //-------------------------------------------------------------- void testApp::setup(){ ofEnableAlphaBlending(); ofEnableSmoothing(); ofSetCircleResolution(12); ofSetColor(0, 0, 255, 100); // speed = 1.0/1000.0; // counter = 0; } //-------------------------------------------------------------- void testApp::update(){ float radius = ofGetWidth()/2.0; for(int i = 0; i < NUM; i++){ // float theta = i*TWO_PI/NUM; // float rd = radius * sin(counter*theta);
  • 22. //X,Y pos[i].x = ofGetWidth()/2.0 + cos(theta)*rd; pos[i].y = ofGetHeight()/2.0 + sin(theta)*rd; } // counter += speed; } //-------------------------------------------------------------- void testApp::draw(){ for(int i = 0; i < NUM; i++){ ofCircle(pos[i].x, pos[i].y, 2); } } ...( )... //-------------------------------------------------------------- void testApp::mouseDragged(int x, int y, int button){ counter += y / 100.0; } ...( )...