(Now obsolete.)
(Cleaned up and updated as part of the full wiki cleanup) (canned edit summary)
 
Line 8: Line 8:
 
| removed    = 3.0
 
| removed    = 3.0
 
}}
 
}}
The '''Change Pen Color by ()''' [[Blocks|block]] is a [[Pen Extension|Pen block]] and a [[Stack Block|stack block]]. The block increments or decrements the [[Pen Color (value)|pen's color]] by the specified value. There are 200 possible colors (0 to 199, inclusive), so color 200 is the same as color 0. In other words, changing the pen color by 200 color will not change the appearance of the pen. In [[Scratch 3.0]], this block was replaced by {{b|Change Pen () by ()}}.
+
The '''Change Pen Color by ()''' [[Blocks|block]] was a [[Pen Extension|Pen block]] and a [[Stack Block|stack block]]. The block changed the [[Pen Color (value)|pen's color]] by the specified value. There are 200 possible colors looping in a rainbow. In [[Scratch 3.0]], this block was replaced by {{b|Change Pen () by ()}}.
  
 
== Example Uses ==
 
== Example Uses ==
 
In [[project]]s that use the pen, the pen ''must'' have a certain color {{-}} this block can change it.
 
In [[project]]s that use the pen, the pen ''must'' have a certain color {{-}} this block can change it.
  
Some common uses for the Change Pen Color by () block are:
+
Some common uses for the Change Pen Color by () block were:
  
 
* Iterating through pen color values while the sprite is moved to create colorful art
 
* Iterating through pen color values while the sprite is moved to create colorful art
Line 45: Line 45:
  
 
== Workaround ==
 
== Workaround ==
This block cannot be replicated with other [[Scratch]] blocks, due to the fact that there is no block that holds the pen color.
+
This block could not be replicated with other [[Scratch]] blocks, due to the fact that there was no block that held the pen color.
  
However, if the block existed, the Change Pen Color by () block could be replaced with the following code:
+
However, if the block existed, the {{b|Change Pen Color by ()}} block could be replaced with the following code:
  
 
<scratchblocks version="2.0">
 
<scratchblocks version="2.0">
Line 53: Line 53:
 
</scratchblocks>
 
</scratchblocks>
  
(This is in fact how Scratch handles pen color internally.)
+
One could use the workaround, though it requires a "pen color" [[variable]] and the following script:
 
 
One can use the workaround, though it requires a "pen color" [[variable]] and the following script:
 
  
 
<scratchblocks version="2.0">
 
<scratchblocks version="2.0">

Latest revision as of 00:14, 25 February 2020

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 Pen Color by ()
2.0 Change Pen Color by ().png
Category Pen
Type Stack
Removed in 3.0

The Change Pen Color by () block was a Pen block and a stack block. The block changed the pen's color by the specified value. There are 200 possible colors looping in a rainbow. In Scratch 3.0, this block was replaced by Change Pen () by ().

Example Uses

In projects that use the pen, the pen must have a certain color — this block can change it.

Some common uses for the Change Pen Color by () block were:

  • Iterating through pen color values while the sprite is moved to create colorful art
forever 
    if <((timer) mod (1)) = [0]> then
        change pen color by (1)
    end
end
  • Varying pen colors for an art program
forever
    change pen color by (loudness)
    wait (2) secs
end
  • In projects that "draw" objects with the pen, changing the color of the object(s)
repeat (360)
    move (1) steps
    turn cw (1) degrees
    change pen color by ((2) / (3.6))
end

Workaround

This block could not be replicated with other Scratch blocks, due to the fact that there was no block that held the pen color.

However, if the block existed, the Change Pen Color by () block could be replaced with the following code:

set pen color to ((pen color) + (amount))

One could use the workaround, though it requires a "pen color" variable and the following script:

when gf clicked
forever
   set pen color to (pen color)
end

To set the pen color, use the Set () to () block; to change it, use the Change () by () block.

See Also