scaling images
BlitzMax Forums/BlitzMax Beginners Area/scaling images
| ||
I have an image in my lower right corner of the screen; its a square; i want to scale it slowly bigger, while at the same time moving diagonally towars the centre of the screen where it stops scaling and moving; i cant seem to come up with an algorithm that works properly. i tried scaling 0.005 and moving 2 pixel X and 1 pixel Y yet while the scale works, the "movement" towards the centre of the screen doesnt seem to work ... i need a smoothe scaling from a corner towards centre; any good ideas for implementations? |
| ||
I had to do the same sort of thing for the Map zooming screen in my framework but it wasn't easy for some reason - perhaps there is a simpler way though... |
| ||
so what did you do? |
| ||
not |
| ||
not quite sure what your after. Do you want a tiny image in the bottom right corner that just expands to be normal scale when it reaches the center of the screen ? If thats the case.. and this is just off the top of my head.. You have a start scale, and start position. You have an end scale and end position. You have a distance to get from start to finish. So as you move the image you can work out how far it has moved ( distance from start position ) So you have a fraction of distance moved. You know the total change in scale ( end scale - start scale ) therefore the scale to draw the image is the total scale change * fraction moved + start scale. Does that make sense ?.. does it even work ?.. dunno.. I not at my home PC to try it. Cheers QuietBloke |
| ||
All you are doing is doing a drawrect with a scale. Just drawrect with an x,y offset which is the center, and the use SetScale to make it change size as its goes. |
| ||
I did something like QuietBloke suggested but with the added complication that the map remained centred as it scaled unless it was near an edge. |