Changing scale based on position on screen

I have some Game Objects that the player can move left and right across the screen. I need for the scale of these objects to be 100% when they are in the center of the screen, and 0% when they are at the edges. And I need a linear curve between the two.

I’m calculating the distance from the center of the screen. I’ve tried using transform.localScale in the Update, but it just adds the scale change on top of the previous scale change, making the object grow (or shrink) infinitely.

Is there a way that I can constantly update the scale of an object compared to its original size, instead of its current size? Or a better way to do this altogether? Working with UnityScript.

I would store the starting scale (the original scale) in a variable.

Then in each update, you can just multiply that starting scale by however much you want to scale it. Then copy this value into the transform.localScale.,You can just store the original scale in a separate variable. Then just scale that each time in the update by whatever.