SlideShare a Scribd company logo
1 of 59
Download to read offline
‣


‣
‣
‣


    ‣
    ‣
    ‣
    ‣


‣
‣


‣



‣
    ‣
    ‣
    ‣
‣
‣
‣
‣
             ::    (   1,   2,    3...){


}


‣

int testApp::poweroftwo(int a){
! return a * a;
}



‣
‣
‣


‣
‣


‣
‣


ofPoint interpolateByPct(float pct);
‣

#pragma once
#include "ofMain.h"

class testApp : public ofBaseApp{
!
public:
! void setup();
! void update();
! void draw();
! void keyPressed (int key);
! void keyReleased(int key);
! void mouseMoved(int x, int y );
! void mouseDragged(int x, int y, int button);
! void mousePressed(int x, int y, int button);
! void mouseReleased(int x, int y, int button);
! void windowResized(int w, int h);
! void dragEvent(ofDragInfo dragInfo);
! void gotMessage(ofMessage msg);
!
! float pct;
! ofPoint currentPos, startPos, endPos;
! ofPoint interpolateByPct(float pct);
};
‣
#include "testApp.h"

void testApp::setup(){
!   ofBackground(0, 0, 0);
!   ofSetFrameRate(60);
!   ofSetRectMode(OF_RECTMODE_CENTER);
!   startPos.set(10, 400);
!   endPos.set(1000, 300);
!   pct = 0;
}

void testApp::update(){
!   pct += 0.01f;
!   if (pct > 1) {
!   !     pct = 0;
!   }!
!   currentPos = interpolateByPct(pct);
}

void testApp::draw(){
!   ofSetColor(31, 127, 255);
!   ofRect(currentPos.x, currentPos.y, 20, 20);
}

ofPoint testApp::interpolateByPct(float pct){
!   ofPoint pos;
!   pos.x = (1-pct) * startPos.x + (pct) * endPos.x;
!   pos.y = (1-pct) * startPos.y + (pct) * endPos.y;
!   return pos;
}
‣
‣
‣
    ‣
    ‣
‣
#pragma once
#include "ofMain.h"

class testApp : public ofBaseApp{
!
public:
! void setup();
! void update();
! void draw();
!
! void keyPressed (int key);
! void keyReleased(int key);
! void mouseMoved(int x, int y );
! void mouseDragged(int x, int y, int button);
! void mousePressed(int x, int y, int button);
! void mouseReleased(int x, int y, int button);
! void windowResized(int w, int h);
! void dragEvent(ofDragInfo dragInfo);
! void gotMessage(ofMessage msg);
!
! float pct;
! ofPoint currentPos, startPos, endPos;
! ofPoint interpolateByPct(float pct);
! void fadeToBlack();
};
‣
#include "testApp.h"

void testApp::setup(){
!   ofSetBackgroundAuto(false);
!   ofSetVerticalSync(true);
!   ofEnableAlphaBlending();
!   ofSetFrameRate(60);
!   ofBackground(0, 0, 0);
!   startPos.set(10, 400);
!   endPos.set(1000, 300);
!   pct = 0;
}

void testApp::update(){
!   pct += 0.01f;
!   if (pct > 1) {
!   !     pct = 0;
!   }!
!   currentPos = interpolateByPct(pct);
}

void testApp::draw(){
!   fadeToBlack();
!   ofSetRectMode(OF_RECTMODE_CENTER);
!   ofSetColor(31, 127, 255);
!   ofRect(currentPos.x, currentPos.y, 20, 20);
}
‣
ofPoint testApp::interpolateByPct(float _pct){
! float pct = _pct;
! ofPoint pos;
! pos.x = (1-pct) * startPos.x + (pct) * endPos.x;
! pos.y = (1-pct) * startPos.y + (pct) * endPos.y;
! return pos;
}

void testApp::fadeToBlack() {
! ofSetRectMode(OF_RECTMODE_CORNER);
! ofSetColor(0, 0, 0, 10);
! ofRect(0, 0, ofGetWidth(), ofGetHeight());
}
‣
‣
‣
‣
‣


‣
‣

‣
‣
#pragma once
#include "ofMain.h"

class testApp : public ofBaseApp{
!
public:
! void setup();
! void update();
! void draw();
! void keyPressed (int key);
! void keyReleased(int key);
! void mouseMoved(int x, int y );
! void mouseDragged(int x, int y, int button);
! void mousePressed(int x, int y, int button);
! void mouseReleased(int x, int y, int button);
! void windowResized(int w, int h);
! void dragEvent(ofDragInfo dragInfo);
! void gotMessage(ofMessage msg);
!
! float pct;
! float shaper;
! ofPoint currentPos, startPos, endPos;
! ofPoint interpolateByPct(float pct, float shaper);
! void fadeToBlack();
};
‣
#include "testApp.h"

void testApp::setup(){
! ofSetBackgroundAuto(false);
! ofSetVerticalSync(true);
! ofEnableAlphaBlending();
! ofSetFrameRate(60);
! ofBackground(0, 0, 0);

!   startPos.set(10, 400);
!   endPos.set(1000, 300);
!   pct = 0.0;
!   shaper = 4.0;
}

void testApp::update(){
! pct += 0.01f;
! if (pct > 1) {
! !      pct = 0;
! }!
! currentPos = interpolateByPct(pct, shaper);
}
‣
void testApp::draw(){
! fadeToBlack();
! ofSetRectMode(OF_RECTMODE_CENTER);
! ofSetColor(31, 127, 255);
! ofRect(currentPos.x, currentPos.y, 20, 20);
}

ofPoint testApp::interpolateByPct(float _pct, float _shaper){
! float pct = powf(_pct, _shaper);
! ofPoint pos;
! pos.x = (1-pct) * startPos.x + (pct) * endPos.x;
! pos.y = (1-pct) * startPos.y + (pct) * endPos.y;
! return pos;
}

void testApp::fadeToBlack() {
! ofSetRectMode(OF_RECTMODE_CORNER);
! ofSetColor(0, 0, 0, 10);
! ofRect(0, 0, ofGetWidth(), ofGetHeight());
}
‣
‣
‣
‣
    ‣
    ‣


‣
    ‣
    ‣
‣
‣
    ‣
    ‣
    ‣
    ‣
    ‣
    ‣
    ‣
    ‣
    ‣

‣
‣
‣


‣
    ‣
    ‣
    ‣
    ‣
    ‣
‣
‣

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID.      HELLOWORLD.
000300 DATE-WRITTEN.    02/05/96       21:04.
000400*AUTHOR    BRIAN COLLINS
000500 ENVIRONMENT DIVISION.
000600 CONFIGURATION SECTION.
000700 SOURCE-COMPUTER. RM-COBOL.
000800 OBJECT-COMPUTER. RM-COBOL.
000900
001000 DATA DIVISION.
001100 FILE SECTION.
001200
100000 PROCEDURE DIVISION.
100100
100200 MAIN-LOGIC SECTION.
100300 BEGIN.
100400     DISPLAY " " LINE 1 POSITION 1 ERASE EOS.
100500     DISPLAY "HELLO, WORLD." LINE 15 POSITION 10.
100600     STOP RUN.
100700 MAIN-LOGIC-EXIT.
100800     EXIT.
‣


‣
    ‣
    ‣
    ‣
‣
‣
    ‣
    ‣
    ‣
    ‣
‣


‣
‣


‣
‣
‣
‣
‣
    ‣


    ‣
    ‣
    ‣


    ‣
‣
‣
‣
‣
‣
‣
To invent programs, you need to be able to capture abstractions and ex
    design. It’s the job of a programming language to help you do this. The
    process of invention and design by letting you encode abstractions tha
    It should let you make your ideas concrete in the code you write. Surf
    the architecture of your program.
‣
‣   All programming languages provide devices that help express abstrac
    are ways of grouping implementation details, hiding them, and giving
‣   a common interface—much as a mechanical object separates its interfa
    illustrated in “Interface and Implementation” .
‣
    Figure 2-1            Inte rfa ce a nd Im ple m e nta tion

    interface                         implementation




                      11
                 10
                9
                 8
                      7
                              6
‣
‣
‣
‣
‣
‣
‣




    getName()   getName()
‣
    ‣
    ‣
‣
‣
‣
‣


‣
‣
‣


‣
‣
    ‣
    ‣
    ‣
    ‣
    ‣


‣
    ‣
    ‣
‣
‣


‣
    ‣


‣
    ‣

‣
    ‣
‣
    ‣
    ‣


‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
#pragma once

#include "ofMain.h"
#include "Rectangle.h"

class testApp : public ofBaseApp{
!
public:
! void setup();
! void update();
! void draw();
!
! void keyPressed (int key);
! void keyReleased(int key);
! void mouseMoved(int x, int y );
! void mouseDragged(int x, int y, int button);
! void mousePressed(int x, int y, int button);
! void mouseReleased(int x, int y, int button);
! void windowResized(int w, int h);
! void dragEvent(ofDragInfo dragInfo);
! void gotMessage(ofMessage msg);
!
! Rectangle myRectangle;
};
‣
#include "testApp.h"

void testApp::setup(){
! ofSetBackgroundAuto(false);
! ofSetVerticalSync(true);
! ofEnableAlphaBlending();
! ofSetFrameRate(60);
! ofBackground(0, 0, 0);
!
! myRectangle.pos.x = ofGetWidth()/2;
! myRectangle.pos.y = ofGetHeight()/2;
}

void testApp::update(){

}

void testApp::draw(){
! myRectangle.draw();
}
‣
#pragma once
#include "ofMain.h"

class Rectangle {

public:
! void draw();
! ofPoint pos;
};
‣
#include "rectangle.h"

void Rectangle::draw() {
! ofFill();
! ofSetRectMode(OF_RECTMODE_CENTER);
! ofSetColor(31,127,255);
! ofRect(pos.x, pos.y, 20,20);
}
‣
‣




‣
    ‣


‣
    ‣
    ‣
    ‣
    ‣
    ‣

More Related Content

What's hot

Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Atsushi Tadokoro
 
The Ring programming language version 1.8 book - Part 61 of 202
The Ring programming language version 1.8 book - Part 61 of 202The Ring programming language version 1.8 book - Part 61 of 202
The Ring programming language version 1.8 book - Part 61 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 65 of 210
The Ring programming language version 1.9 book - Part 65 of 210The Ring programming language version 1.9 book - Part 65 of 210
The Ring programming language version 1.9 book - Part 65 of 210Mahmoud Samir Fayed
 
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)jon_bell
 
Javascript Common Mistakes
Javascript Common MistakesJavascript Common Mistakes
Javascript Common Mistakes동수 장
 
Tarea De Scilab By Sebastian Vasquez
Tarea De Scilab By Sebastian VasquezTarea De Scilab By Sebastian Vasquez
Tarea De Scilab By Sebastian VasquezSebastian Vasquez
 
The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196Mahmoud Samir Fayed
 
如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test名辰 洪
 
JavaScript - Agora nervoso
JavaScript - Agora nervosoJavaScript - Agora nervoso
JavaScript - Agora nervosoLuis Vendrame
 
YQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to userYQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to userTom Croucher
 
Openframworks x Mobile
Openframworks x MobileOpenframworks x Mobile
Openframworks x MobileJanet Huang
 
Ensemble: A DSL for Concurrency, Adaptability, and Distribution
Ensemble: A DSL for Concurrency, Adaptability, and DistributionEnsemble: A DSL for Concurrency, Adaptability, and Distribution
Ensemble: A DSL for Concurrency, Adaptability, and Distributionjhebus
 
Data Structures : array operations in c program
Data Structures : array operations in c program Data Structures : array operations in c program
Data Structures : array operations in c program Raghavendra Narayan
 

What's hot (20)

Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2
 
The Ring programming language version 1.8 book - Part 61 of 202
The Ring programming language version 1.8 book - Part 61 of 202The Ring programming language version 1.8 book - Part 61 of 202
The Ring programming language version 1.8 book - Part 61 of 202
 
The Ring programming language version 1.9 book - Part 65 of 210
The Ring programming language version 1.9 book - Part 65 of 210The Ring programming language version 1.9 book - Part 65 of 210
The Ring programming language version 1.9 book - Part 65 of 210
 
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
 
Primer Punto
Primer PuntoPrimer Punto
Primer Punto
 
Javascript Common Mistakes
Javascript Common MistakesJavascript Common Mistakes
Javascript Common Mistakes
 
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
 
Tarea De Scilab By Sebastian Vasquez
Tarea De Scilab By Sebastian VasquezTarea De Scilab By Sebastian Vasquez
Tarea De Scilab By Sebastian Vasquez
 
Vcs8
Vcs8Vcs8
Vcs8
 
The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196
 
Of class1
Of class1Of class1
Of class1
 
Stack Data Structure
Stack Data StructureStack Data Structure
Stack Data Structure
 
如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test
 
JavaScript - Agora nervoso
JavaScript - Agora nervosoJavaScript - Agora nervoso
JavaScript - Agora nervoso
 
YQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to userYQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to user
 
Final ds record
Final ds recordFinal ds record
Final ds record
 
Openframworks x Mobile
Openframworks x MobileOpenframworks x Mobile
Openframworks x Mobile
 
Ensemble: A DSL for Concurrency, Adaptability, and Distribution
Ensemble: A DSL for Concurrency, Adaptability, and DistributionEnsemble: A DSL for Concurrency, Adaptability, and Distribution
Ensemble: A DSL for Concurrency, Adaptability, and Distribution
 
Sbaw090623
Sbaw090623Sbaw090623
Sbaw090623
 
Data Structures : array operations in c program
Data Structures : array operations in c program Data Structures : array operations in c program
Data Structures : array operations in c program
 

Similar to openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII

Similar to openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII (20)

Of class3
Of class3Of class3
Of class3
 
Of class2
Of class2Of class2
Of class2
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 
Day 5
Day 5Day 5
Day 5
 
Double linked list
Double linked listDouble linked list
Double linked list
 
mobl
moblmobl
mobl
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in c
 
Python-GTK
Python-GTKPython-GTK
Python-GTK
 
BCSL 058 solved assignment
BCSL 058 solved assignmentBCSL 058 solved assignment
BCSL 058 solved assignment
 
Bti1022 lab sheet 7
Bti1022 lab sheet 7Bti1022 lab sheet 7
Bti1022 lab sheet 7
 
C
CC
C
 
efy-articles
efy-articlesefy-articles
efy-articles
 
Mgd08 lab01
Mgd08 lab01Mgd08 lab01
Mgd08 lab01
 
Unit2 C
Unit2 C Unit2 C
Unit2 C
 
Unit2 C
Unit2 CUnit2 C
Unit2 C
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
Java awt
Java awtJava awt
Java awt
 
Dti2143 lab sheet 6
Dti2143 lab sheet 6Dti2143 lab sheet 6
Dti2143 lab sheet 6
 

More from Atsushi Tadokoro

「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望Atsushi Tadokoro
 
プログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめようプログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめようAtsushi Tadokoro
 
coma Creators session vol.2
coma Creators session vol.2coma Creators session vol.2
coma Creators session vol.2Atsushi Tadokoro
 
Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1Atsushi Tadokoro
 
Interactive Music II Processingによるアニメーション
Interactive Music II ProcessingによるアニメーションInteractive Music II Processingによるアニメーション
Interactive Music II ProcessingによるアニメーションAtsushi Tadokoro
 
Interactive Music II Processing基本
Interactive Music II Processing基本Interactive Music II Processing基本
Interactive Music II Processing基本Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携Atsushi Tadokoro
 
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)Atsushi Tadokoro
 
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描くiTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描くAtsushi Tadokoro
 
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリメディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリAtsushi Tadokoro
 
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使うAtsushi Tadokoro
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2Atsushi Tadokoro
 
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得Atsushi Tadokoro
 
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3DプログラミングWebデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3DプログラミングAtsushi Tadokoro
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1Atsushi Tadokoro
 
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画するiTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画するAtsushi Tadokoro
 
Media Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替えMedia Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替えAtsushi Tadokoro
 
Interactive Music II SuperCollider実習 オリジナルの楽器を作ろう!
Interactive Music II SuperCollider実習  オリジナルの楽器を作ろう!Interactive Music II SuperCollider実習  オリジナルの楽器を作ろう!
Interactive Music II SuperCollider実習 オリジナルの楽器を作ろう!Atsushi Tadokoro
 

More from Atsushi Tadokoro (20)

「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
 
プログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめようプログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめよう
 
coma Creators session vol.2
coma Creators session vol.2coma Creators session vol.2
coma Creators session vol.2
 
Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1
 
Interactive Music II Processingによるアニメーション
Interactive Music II ProcessingによるアニメーションInteractive Music II Processingによるアニメーション
Interactive Music II Processingによるアニメーション
 
Interactive Music II Processing基本
Interactive Music II Processing基本Interactive Music II Processing基本
Interactive Music II Processing基本
 
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
 
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
 
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
 
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描くiTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
 
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリメディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
 
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
 
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
 
Tamabi media131118
Tamabi media131118Tamabi media131118
Tamabi media131118
 
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3DプログラミングWebデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
 
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画するiTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
 
Media Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替えMedia Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替え
 
Interactive Music II SuperCollider実習 オリジナルの楽器を作ろう!
Interactive Music II SuperCollider実習  オリジナルの楽器を作ろう!Interactive Music II SuperCollider実習  オリジナルの楽器を作ろう!
Interactive Music II SuperCollider実習 オリジナルの楽器を作ろう!
 

Recently uploaded

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 

Recently uploaded (20)

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 

openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII

  • 1.
  • 3.
  • 4. ‣ ‣ ‣ ‣ ‣
  • 5. ‣ ‣ ‣ ‣ ‣ ‣
  • 7. :: ( 1, 2, 3...){ } ‣ int testApp::poweroftwo(int a){ ! return a * a; } ‣
  • 9. ‣ #pragma once #include "ofMain.h" class testApp : public ofBaseApp{ ! public: ! void setup(); ! void update(); ! void draw(); ! void keyPressed (int key); ! void keyReleased(int key); ! void mouseMoved(int x, int y ); ! void mouseDragged(int x, int y, int button); ! void mousePressed(int x, int y, int button); ! void mouseReleased(int x, int y, int button); ! void windowResized(int w, int h); ! void dragEvent(ofDragInfo dragInfo); ! void gotMessage(ofMessage msg); ! ! float pct; ! ofPoint currentPos, startPos, endPos; ! ofPoint interpolateByPct(float pct); };
  • 10. ‣ #include "testApp.h" void testApp::setup(){ ! ofBackground(0, 0, 0); ! ofSetFrameRate(60); ! ofSetRectMode(OF_RECTMODE_CENTER); ! startPos.set(10, 400); ! endPos.set(1000, 300); ! pct = 0; } void testApp::update(){ ! pct += 0.01f; ! if (pct > 1) { ! ! pct = 0; ! }! ! currentPos = interpolateByPct(pct); } void testApp::draw(){ ! ofSetColor(31, 127, 255); ! ofRect(currentPos.x, currentPos.y, 20, 20); } ofPoint testApp::interpolateByPct(float pct){ ! ofPoint pos; ! pos.x = (1-pct) * startPos.x + (pct) * endPos.x; ! pos.y = (1-pct) * startPos.y + (pct) * endPos.y; ! return pos; }
  • 11. ‣ ‣ ‣ ‣ ‣
  • 12. ‣ #pragma once #include "ofMain.h" class testApp : public ofBaseApp{ ! public: ! void setup(); ! void update(); ! void draw(); ! ! void keyPressed (int key); ! void keyReleased(int key); ! void mouseMoved(int x, int y ); ! void mouseDragged(int x, int y, int button); ! void mousePressed(int x, int y, int button); ! void mouseReleased(int x, int y, int button); ! void windowResized(int w, int h); ! void dragEvent(ofDragInfo dragInfo); ! void gotMessage(ofMessage msg); ! ! float pct; ! ofPoint currentPos, startPos, endPos; ! ofPoint interpolateByPct(float pct); ! void fadeToBlack(); };
  • 13. ‣ #include "testApp.h" void testApp::setup(){ ! ofSetBackgroundAuto(false); ! ofSetVerticalSync(true); ! ofEnableAlphaBlending(); ! ofSetFrameRate(60); ! ofBackground(0, 0, 0); ! startPos.set(10, 400); ! endPos.set(1000, 300); ! pct = 0; } void testApp::update(){ ! pct += 0.01f; ! if (pct > 1) { ! ! pct = 0; ! }! ! currentPos = interpolateByPct(pct); } void testApp::draw(){ ! fadeToBlack(); ! ofSetRectMode(OF_RECTMODE_CENTER); ! ofSetColor(31, 127, 255); ! ofRect(currentPos.x, currentPos.y, 20, 20); }
  • 14. ‣ ofPoint testApp::interpolateByPct(float _pct){ ! float pct = _pct; ! ofPoint pos; ! pos.x = (1-pct) * startPos.x + (pct) * endPos.x; ! pos.y = (1-pct) * startPos.y + (pct) * endPos.y; ! return pos; } void testApp::fadeToBlack() { ! ofSetRectMode(OF_RECTMODE_CORNER); ! ofSetColor(0, 0, 0, 10); ! ofRect(0, 0, ofGetWidth(), ofGetHeight()); }
  • 15.
  • 17. ‣ #pragma once #include "ofMain.h" class testApp : public ofBaseApp{ ! public: ! void setup(); ! void update(); ! void draw(); ! void keyPressed (int key); ! void keyReleased(int key); ! void mouseMoved(int x, int y ); ! void mouseDragged(int x, int y, int button); ! void mousePressed(int x, int y, int button); ! void mouseReleased(int x, int y, int button); ! void windowResized(int w, int h); ! void dragEvent(ofDragInfo dragInfo); ! void gotMessage(ofMessage msg); ! ! float pct; ! float shaper; ! ofPoint currentPos, startPos, endPos; ! ofPoint interpolateByPct(float pct, float shaper); ! void fadeToBlack(); };
  • 18. ‣ #include "testApp.h" void testApp::setup(){ ! ofSetBackgroundAuto(false); ! ofSetVerticalSync(true); ! ofEnableAlphaBlending(); ! ofSetFrameRate(60); ! ofBackground(0, 0, 0); ! startPos.set(10, 400); ! endPos.set(1000, 300); ! pct = 0.0; ! shaper = 4.0; } void testApp::update(){ ! pct += 0.01f; ! if (pct > 1) { ! ! pct = 0; ! }! ! currentPos = interpolateByPct(pct, shaper); }
  • 19. ‣ void testApp::draw(){ ! fadeToBlack(); ! ofSetRectMode(OF_RECTMODE_CENTER); ! ofSetColor(31, 127, 255); ! ofRect(currentPos.x, currentPos.y, 20, 20); } ofPoint testApp::interpolateByPct(float _pct, float _shaper){ ! float pct = powf(_pct, _shaper); ! ofPoint pos; ! pos.x = (1-pct) * startPos.x + (pct) * endPos.x; ! pos.y = (1-pct) * startPos.y + (pct) * endPos.y; ! return pos; } void testApp::fadeToBlack() { ! ofSetRectMode(OF_RECTMODE_CORNER); ! ofSetColor(0, 0, 0, 10); ! ofRect(0, 0, ofGetWidth(), ofGetHeight()); }
  • 20.
  • 21.
  • 22.
  • 23. ‣ ‣ ‣ ‣ ‣ ‣ ‣
  • 24. ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣
  • 25. ‣ ‣ ‣ ‣ ‣ ‣ ‣
  • 26.
  • 27. ‣ 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. HELLOWORLD. 000300 DATE-WRITTEN. 02/05/96 21:04. 000400*AUTHOR BRIAN COLLINS 000500 ENVIRONMENT DIVISION. 000600 CONFIGURATION SECTION. 000700 SOURCE-COMPUTER. RM-COBOL. 000800 OBJECT-COMPUTER. RM-COBOL. 000900 001000 DATA DIVISION. 001100 FILE SECTION. 001200 100000 PROCEDURE DIVISION. 100100 100200 MAIN-LOGIC SECTION. 100300 BEGIN. 100400 DISPLAY " " LINE 1 POSITION 1 ERASE EOS. 100500 DISPLAY "HELLO, WORLD." LINE 15 POSITION 10. 100600 STOP RUN. 100700 MAIN-LOGIC-EXIT. 100800 EXIT.
  • 28. ‣ ‣ ‣ ‣ ‣
  • 29.
  • 30. ‣ ‣ ‣ ‣
  • 32.
  • 33. ‣ ‣ ‣ ‣ ‣
  • 36.
  • 37. To invent programs, you need to be able to capture abstractions and ex design. It’s the job of a programming language to help you do this. The process of invention and design by letting you encode abstractions tha It should let you make your ideas concrete in the code you write. Surf the architecture of your program. ‣ ‣ All programming languages provide devices that help express abstrac are ways of grouping implementation details, hiding them, and giving ‣ a common interface—much as a mechanical object separates its interfa illustrated in “Interface and Implementation” . ‣ Figure 2-1 Inte rfa ce a nd Im ple m e nta tion interface implementation 11 10 9 8 7 6
  • 39. ‣ ‣ ‣ ‣ getName() getName()
  • 40. ‣ ‣
  • 43.
  • 44. ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣
  • 45. ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣
  • 46. ‣ ‣ ‣ ‣
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 54. ‣ #pragma once #include "ofMain.h" #include "Rectangle.h" class testApp : public ofBaseApp{ ! public: ! void setup(); ! void update(); ! void draw(); ! ! void keyPressed (int key); ! void keyReleased(int key); ! void mouseMoved(int x, int y ); ! void mouseDragged(int x, int y, int button); ! void mousePressed(int x, int y, int button); ! void mouseReleased(int x, int y, int button); ! void windowResized(int w, int h); ! void dragEvent(ofDragInfo dragInfo); ! void gotMessage(ofMessage msg); ! ! Rectangle myRectangle; };
  • 55. ‣ #include "testApp.h" void testApp::setup(){ ! ofSetBackgroundAuto(false); ! ofSetVerticalSync(true); ! ofEnableAlphaBlending(); ! ofSetFrameRate(60); ! ofBackground(0, 0, 0); ! ! myRectangle.pos.x = ofGetWidth()/2; ! myRectangle.pos.y = ofGetHeight()/2; } void testApp::update(){ } void testApp::draw(){ ! myRectangle.draw(); }
  • 56. ‣ #pragma once #include "ofMain.h" class Rectangle { public: ! void draw(); ! ofPoint pos; };
  • 57. ‣ #include "rectangle.h" void Rectangle::draw() { ! ofFill(); ! ofSetRectMode(OF_RECTMODE_CENTER); ! ofSetColor(31,127,255); ! ofRect(pos.x, pos.y, 20,20); }
  • 58.
  • 59. ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣