How can I add resistance to a mouse drag?

Hello, I am currently using this simple script for draggable objects

using UnityEngine;

public class SC_DragRigidbody : MonoBehaviour
{
    Vector2 difference = Vector2.zero;

    private void OnMouseDown()
    {
        difference = (Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition) - (Vector2)transform.position;
   
    }

    private void OnMouseDrag()
    {
        transform.position = (Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition) - difference;
    }


}

and I need to give the on drag mouse movement a little resistance like so (the speed being the highest at the start and gradually decreases). Any ideas on how should I alter my code?

Thanks in advance.

Do you want it to behave like a rubber band that has more resistance the farther you stretch?

To make this effect work well, you’re probably going to have to work with actual coordinates, not speed of movement. Remember the original position, and then on each drag, see the new mouse position and decide what percentage of the distance is appropriate.

Or do you want it the object to follow the mouse like it’s chasing the pointer?

Similar to the above, you’ll have to check the position, and remember the previous position, and then decide based on that distance how far you want to adjust the object’s position.

Yeah the rubber one is what I had in mind. How should the code be like? Sorry, I am not really good at scripting.