Rotate example

Processing sketch

Rotate.pde
/**
 * Rotate 
 * 
 * Example for the pogg library by Octavi Estape.
 * It plays a Theora movie that you can rotate with the mouse.
 */
 
import pogg.*;
 
TheoraMovie myMovie;
 
 
void setup() {
  frameRate(10);
  size(320, 240);
 
  //TheoraMovie.printLogs(true);
  myMovie = new TheoraMovie(this, "BugsShort.ogg");
  myMovie.loop();
 
  smooth();
 
}
 
void draw() {
  background(0);
 
  myMovie.read();
 
  float angle = (mouseX-(float)width/(float)2)/((float)width/(float)2)*PI;
  pushMatrix();
 
  translate(width/2, mouseY);
  rotate(angle);
  translate(-myMovie.width/2, -myMovie.height/2);
 
  image(myMovie, 0, 0);
 
  popMatrix();
 
}

Result

This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

Comments

Enter your comment
ZXPKO
 
 
Back to top
rotate_example.txt · Last modified: 2021/08/05 14:38 (external edit)
 
 
CC Attribution-Noncommercial-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0