Q:

Animating an SVG

I'm using the program Processing to create an animation. One of the clips I'm struggling with is to make an object (In this case an SVG) move up to a certain point and then back down. The motion I was going for was a smooth, fast jab up and then slower going down and repeat this motion. I've managed to get this so far:
PShape gunhand;
float y = 600;
float speed = 3;    

void setup() {
size(1280,720);
gunhand = loadShape("gunhand.svg"); 
}

void draw() {
background(0);
move();
display();
}

void move() {

if (y > 300) {
y = y - speed;

}
else{y = 300;}
}

void display() {
shape(gunhand, width/6, y, 1000,500);

}

Any help, I am greatful for, thanks!

A:

one way would be like this:
void move() {
  y = y - speed;
  if (y < 300) {
    speed = speed *-0.5;
    y = 301;
  }
}

