We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Here's what I've got so far. I've kept it as basic as possible. It 'works' in an extremely kludgy fashion– if I keep mashing the 'S' key, it will eventually cycle through all the parts of the AniSequence rotate01, but it will just jump from value to value instead of tweening between them as desired. I'm not really sure how to fix it, so any comments or suggestions are much appreciated.
import de.looksgood.ani.*;
import de.looksgood.ani.easing.*;
AniSequence rotate01;
float rotation;
int currentstep;
void setup(){
background(50);
size(500,500);
frameRate(60);
smooth(8);
rotation = 0;
currentstep=0;
Ani.init(this);
rotate01 = new AniSequence(this);
rotate01.beginSequence();
rotate01.add(Ani.to(this,0.3,"rotation",PI/2));
rotate01.add(Ani.to(this,0.3,"rotation",PI));
rotate01.add(Ani.to(this,0.3,"rotation",PI+PI/2));
rotate01.add(Ani.to(this,0.3,"rotation",TWO_PI));
rotate01.endSequence();
}
void draw(){
background(50);
if (rotate01.getSeek()>(1/rotate01.getStepCount())*currentstep){
rotate01.pause();
}
fill(205);
noStroke();
pushMatrix();
translate(width/2,height/2);
rotate(rotation);
rect(0,0,100,50);
popMatrix();
}
void keyPressed(){
if (!rotate01.isPlaying()){
if (rotate01.isEnded()){
currentstep = 0;
}
if (key=='s'||key=='S'){
if (currentstep==0){
currentstep = rotate01.getStepNumber();
rotate01.start();
}
if (currentstep > 0){
currentstep = rotate01.getStepNumber();
rotate01.resume();
}
}
}
}