This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective. |
Change Stretch by () | |
change stretch by ():: looks | |
Category | Looks |
Type | Stack |
Removed in | 23May05 (0.x) |
The Change Stretch by () block was a Looks block and a Stack block. It made the sprite stretch horizontally. It was removed from the block palette in Scratch 23May05 for unknown reasons.
Workaround
There is no workaround using only blocks, but one can repeatedly duplicate costumes in the paint editor, stretching each one slightly more than the last to create the effect. The first costume can be designed to have no stretch, and the last costume can have the maximum stretch. The costumes can then be iterated to create the visual effect of a sprite stretching. The following script implies that there are 100 costumes in the sprite:
define change stretch by (n) if <((costume [number v]) + (n)) > [100]> then switch costume to (costume 100 v) else if <((costume [number v]) + (n)) < [1]> then switch costume to (costume 1 v) else switch costume to ((costume [number v]) + (n)) end end
However, the above script may not completely replicate the block since it depends on the stretch difference between each sprite along with the total number of costumes. Since making many costumes can be a daunting task, ten costumes, for instance, can be used instead. It is also best to use a variable to keep track of the actual "stretch" value. A variable called "stretch" can be used for this. and the following script can be used instead.
Note: | "0" is the minimum stretch, "100" is the maximum. |
define change stretch by (n) with (num_costumes) number of costumes change [stretch v] by (n) if <(stretch) > [100]> then set [stretch v] to [100] end if <(stretch) < [1]> then set [stretch v] to [1] end switch costume to ([ceiling v] of ((stretch) / (num_costumes)))
See Also
For sprites |
Say () for () Seconds • Say () • Think () for () Seconds • Think () • Switch Costume to () • Next Costume • Switch Backdrop to () • Next Backdrop • Change Size by () • Set Size to ()% • Change () Effect by () • Set () Effect to () • Clear Graphic Effects • Show • Hide • Go to () Layer • Go () () Layers • Costume () • Backdrop () • Size
|
For the Stage |