if you press space the ellipse jumps, but it stops very abruptly how can i slow it down instead?
//visual
PImage shrek;
boolean invert= false;
//timer
//moving
float charx=0;
float chary=563-25;
boolean jumping= false;
float gravity= 10;
float jumpingheight=200;
void setup() {
size(1000, 563);
shrek= loadImage("shrek.jpg");
}
void draw() {
frameRate(60);
//visual
background(shrek);
color(255);
ellipse(charx, chary, 50, 50);
//timer
println(millis()/1000);
if (millis()/1000%300==0&&millis()/1000>10&& invert==false) {
invert=true;
}
if (millis()/1000%600==0&&millis()/1000>10&& invert==true) {
invert=false;
}
if (invert==true) {
filter(INVERT);
}
//moving
if (keyPressed) {
//move left with a
if (key == 'a'&&invert==false) {
charx=charx-10;
}
//move right with d
if (key == 'd'&&invert==false) {
charx=charx+10;
}
//move right with a
if (key == 'a'&&invert==true) {
charx=charx+10;
}
//move left with d
if (key == 'd'&&invert==true) {
charx=charx-10;
}
if (key == ' '&&chary>height-jumpingheight) {
jumping=true;
}
}
if (charx>=width-25) {
charx=width-25;
}
if (charx<=0+25) {
charx= 0+25;
}
if (jumping==true) {
chary=chary-10;
charx=charx+0.1;
if (chary<=height-jumpingheight) {
jumping=false;
}
}
if (chary!=height-25&&jumping==false) {
chary+=gravity;
}
}