Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

How can I make kenburns effect from rect1 to rect2?

$
0
0

@bemoregt wrote:

Hi All.

I made kenburns effect like animated image magnification.

At now, I am using ofScale and x0, y0.
But, I want to convert from rect1 to rect2.

How can I make kenburns effect from rect1 to rect2?

My Code:
//--------------------------------------------------------------
void ofApp::setup(){
img1.load("/Users/mun/Desktop/lena512.png");

rect1= ofRectangle(0, 0, 1024, 768);
rect2= ofRectangle(100, 100, 102, 77);

t=1;
xx= 1;
yy= 1;

}

//--------------------------------------------------------------
void ofApp::update(){

ofSleepMillis(30);
img1.update();
ss= 1 + t * 0.01;

t += 1;
if(t > 500) t = 0;

}

//--------------------------------------------------------------
void ofApp::draw(){

ofBackground(75);

ofSetColor(255, 255, 255);
//ofScale(4.0f, 4.0f, 1.0f);
ofScale(ss);
img1.draw(xx-t*0.5, yy-t*0.5);   

}

Thanks.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles