scaling guiTexture

I’m trying to achieve a scaling effect where overtime the guiTexture will scale from it’s original size to large and back to the original size over the coarse of something like 3 seconds. I haven’t scaled any guiTexture through code before and am unsure how to achieve this effect. Also I want to keep the texture center.

PixelInset is a Rect value which can be assigned easily in code. If you wanted to make a system where it is determinted in terms of an X/Y size and X/Y centre position, you could do something like this (fine I can do javascript too (grumble grumble)):

function SetPixelRect(size : Vector2, position : Vector2)
{
    var newPixelRect : Rect = Rect(position.x - (size.x / 2),
                                 position.y - (size.y / 2),
                                 size.x,
                                 size.y);
    texture.pixelInset = newPixelRect;
}

Then to set the size in code, call

SetPixelRect(Vector2(width, height), Vector2(centreX, centreY));

It occurs to me that there is an even cleverer way of doing this, but it only works in C# ;)