My idea is that a sprite with any location and any size can cleanly slide into a certain position and size, essentially growing to that location or shrinking to that location, depending on how big it is.
An important requirement is that I want the sprite to finish changing size at the exact moment it arrives at its destination, so I had my block detect the distance, detect the size, calculate the differences between the current state of those variables, and change each of them by 1/20 of the difference.
For example, Sprite A is at 0,0 with a size of 30. I want it to go to 100, 60 with a size of 12. I had my block change the size by (30-12=18)/20 (i chose 20 increments because it seemed smooth enough without overdoing it). I also had it change the x value by (100-0=100)/20, and the y value by (60-0=60)/20.
Doing all of this in one increment, effectively just changing the values without smoothly gliding, works fine. But when I did it in 20 increments, it always ended at the wrong size and position. Here is a link to the project: Snap! Build Your Own Blocks
Try moving to a random location+size, then clicking the big script to see what I mean. How can I fix this?
