Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animations don't always end on target #4

Open
akiersky opened this issue Mar 22, 2013 · 0 comments
Open

Animations don't always end on target #4

akiersky opened this issue Mar 22, 2013 · 0 comments
Labels

Comments

@akiersky
Copy link

Continuing from the post over here: https://forum.processing.org/topic/ani-animation-overrun

Having issues with animations not always ending on the targets I set. It seems to be most prevalent when when using easing and delays.

Here's some sample code:

import de.looksgood.ani.*;
import de.looksgood.ani.easing.*;

float x1, x2, x3, x4, x5;
float y1, y2, y3, y4, y5;

float target;

void setup() {
  size(500, 500);
  Ani.init(this);
  target = 0;

  y1 = 0;
  y2 = 100;
  y3 = 200;
  y4 = 300;
  y5 = 400;

  x1 = 400;
  x2 = 400;
  x3 = 400;
  x4 = 400;
  x5 = 400;
}

void draw() {
  background(255);
  fill(0);
  rect(x1, y1, 100, 100);
  rect(x2, y2, 100, 100);
  rect(x3, y3, 100, 100);
  rect(x4, y4, 100, 100);
  rect(x5, y5, 100, 100);

}

void mousePressed() {
  Ani.to(this, 1, 0.1, "x1", target, Ani.EXPO_IN_OUT);
  Ani.to(this, 1, 0.2, "x2", target, Ani.EXPO_IN_OUT);
  Ani.to(this, 1, 0.3, "x3", target, Ani.EXPO_IN_OUT);
  Ani.to(this, 1, 0.4, "x4", target, Ani.EXPO_IN_OUT);
  Ani.to(this, 1, 0.5, "x5", target, Ani.EXPO_IN_OUT);
  if(target == 0) {
    target = 400;
  } else {
    target = 0;
  }
}

I find that the center square is always a few pixels left of the other four when animating to the right side.

hopefully this helps track down the issue.
Thanks!
ak

@b-g b-g added the bug label Jun 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants