Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void prepareColorsList(Color c) {
- Color end = reFactorAlphaBy(c, 0);
- ar.clear();
- ar.add(c);
- while (!ColorsEquals(c, end)) {
- ar.add((c = step(c, end)));
- }
- }
- public static int babySteps(int from, int to, int max) {
- int ret = 0;
- if (from > to) {
- for (int j = 0; j <= max; j++) {
- if (from >= to + j) {
- ret = -j;
- } else {
- break;
- }
- }
- } else if (from < to) {
- for (int j = 0; j <= max; j++) {
- if (from + j <= to) {
- ret = j;
- } else {
- break;
- }
- }
- }
- return ret;
- }
- @Override
- public void actionPerformed(ActionEvent e) {
- draw.height += babySteps(draw.height, follow.height, 2);
- draw.width += babySteps(draw.width, follow.width, 2);
- draw.x += babySteps(draw.x, follow.x, 2);
- draw.y += babySteps(draw.y, follow.y, 2);
- getComponent().repaint();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement