Archive.png 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 ().gif
Category Looks
Type Stack

The Change Stretch by () block was a Looks block and a Stack block. It made the sprite stretch horizontally. The stretch would reset when adjusting the size of a sprite.[citation needed] It was removed in an early version of Scratch for unknown reasons and made an obsolete block. This block is not in Scratch 2.0 anymore, but is still usable in the Scratch 1.4 offline editor.

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 in order 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 #) + (n)) > [100]> then
  switch costume to [costume 100 v]
else
  if <((costume #) + (n)) < [1]> then
  switch costume to [costume 1 v]
  else
    switch costume to ((costume #) + (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 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