m (See Also: Changed link; mentioned that it's double.)
(Cleaned up and updated as part of the full wiki cleanup) (canned edit summary)
 
(22 intermediate revisions by 15 users not shown)
Line 1: Line 1:
 +
{{obsolete feature}}
 
{{block
 
{{block
 
| name      = Change Pen Color by ()
 
| name      = Change Pen Color by ()
| image      = File:Change_Pen_Color_by_().png
+
| image      = File:2.0 Change_Pen_Color_by_().png
| imagewidth = 146
+
| category  = [[Pen Extension|Pen]]
| category  = [[Pen Blocks|Pen]]
 
 
| type      = [[Stack Block|Stack]]
 
| type      = [[Stack Block|Stack]]
 
| default    = 10
 
| default    = 10
}}The '''Change Pen Color by ()''' [[Blocks|block]] is a [[Pen Blocks|Pen block]] and a [[Stack Block|Stack block]]. The block increments or decrements the [[Pen Color (value)|pen's color]] by the specified value. The color value holds 199 different values of colors, so the 200th pen color value is the same color as a 0 pen color value. In other words, if you change the pen color by 200, the color will remain unchanged.
+
| removed    = 3.0
==Workaround==
+
}}
This block cannot be replicated with other [[Scratch]] blocks, due to the fact that there is no block that holds the pen color.
+
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 ()}}.
  
However, if the block existed, the '''Change Pen Color by ()''' block could be replicated with the following code:
+
== Example Uses ==
 +
In [[project]]s that use the pen, the pen ''must'' have a certain color {{-}} this block can change it.
  
[[File:Workaround_for_the_Change_Pen_Color_by_()_block.png]]
+
Some common uses for the Change Pen Color by () block were:
  
Nevertheless, that is how Scratch itself does it internally.
+
* Iterating through pen color values while the sprite is moved to create colorful art
  
If one chooses to, one can have a workaround; but that requires the entire project to be changed block by block. A variable called "pen color" must be created, then the following script needs to be made:
+
<scratchblocks version="2.0">
<scratchblocks>
+
forever
when gf clicked
+
    if <((timer) mod (1)) = [0]> then
 +
        change pen color by (1)
 +
    end
 +
end
 +
</scratchblocks>
 +
 
 +
* Varying pen colors for an art program
 +
 
 +
<scratchblocks version="2.0">
 
forever
 
forever
set pen color to (pen color)
+
    change pen color by (loudness)
 +
    wait (2) secs
 +
end
 
</scratchblocks>
 
</scratchblocks>
  
Then to set the pen color, one uses the Set variable block and to change it, one uses the change variable block.
+
* In projects that "draw" objects with the pen, changing the color of the object(s)
==Example Uses==
 
In [[Project|projects]] that use the pen, the pen ''must'' have a certain color (no transparency allowed) {{-}} this block can change it.
 
  
Some common uses for the '''Change Pen Color by ()''' block:
+
<scratchblocks version="2.0">
*Iterating through the pen color values while the pen is being used to create colorful art
+
repeat (360)
 +
    move (1) steps
 +
    turn cw (1) degrees
 +
    change pen color by ((2) / (3.6))
 +
end
 +
</scratchblocks>
  
<scratchblocks>forever if <((timer) mod (1)) = [0]>
+
== Workaround ==
change pen color by (1)</scratchblocks>
+
This block could not be replicated with other [[Scratch]] blocks, due to the fact that there was no block that held the pen color.
  
*Varying pen colors for an art program
+
However, if the block existed, the {{b|Change Pen Color by ()}} block could be replaced with the following code:
  
<scratchblocks>forever if <loud?>
+
<scratchblocks version="2.0">
change pen color by (10)
+
set pen color to ((pen color) + (amount))
wait (2) secs</scratchblocks>
+
</scratchblocks>
 +
 
 +
One could use the workaround, though it requires a "pen color" [[variable]] and the following script:
 +
 
 +
<scratchblocks version="2.0">
 +
when gf clicked
 +
forever
 +
  set pen color to (pen color)
 +
end
 +
</scratchblocks>
  
*In projects that "draw" objects with the pen, changing the color of the object(s)
+
To set the pen color, use the {{b|Set () to ()}} block; to change it, use the {{b|Change () by ()}} block.
  
<scratchblocks>repeat (360)
+
== See Also ==
move (1) steps
+
* [[Set Pen Color to () (block)|Set Pen Color to ()]]
turn cw (1) degrees
+
* [[Pen Color (value)|Pen Color]]
change pen color by ((2)/(3.6))
 
end</scratchblocks>
 
  
==See Also==
+
{{Pen Extension}}
*[[Set Pen Color to () (block)|Set Pen Color to ()]] (2 blocks)
+
{{Removed Blocks}}
*[[Pen Color (value)|Pen Color]]
+
[[Category:Pen Extension]]
{{Pen Blocks}}
+
[[de:Ändere Stiftfarbe um () (Block)]]
[[Category:Pen Blocks]]
+
[[ja:ペンの色を () ずつ変える (ブロック)]]
 +
[[ru:Изменить цвет пера на ()]]

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