Animate position after button press

I have a GLTF model loaded in my canvas. I added a function that moves the object back and forth after pressing a 2D button:

function move() {
	if(mesh2 && (mesh2.position.y >= 200)) {
		mesh2.position.y -= 100;
	} else {
		mesh2.position.y += 100;
	}
}

Instead of doing a smooth animation, the objects just jumps to the other position instantly.

How do I toggle a position animation after a button press?

A very simple example with GSAP: https://jsfiddle.net/g5yf081L/

The relevant animation code in the fiddle is:

gsap.to( mesh.position, {
    duration: 1,
    x: 1
} );

which animates the mesh from (0,0,0) to (1,0,0) in one second.

Works like a charm! Thank you.