(Redirected from Color Effect)
- "Effect" redirects here. For sound effects, see Sound Effect.
A graphic effect is an effect that can be used on a sprite or the stage, changing their look in some way. These blocks can be found under the Looks section.
Related Blocks
There are three blocks that can change how an effect is being used on a sprite or the stage. Those three blocks are:
change [ v] effect by ()
— This changes the strength of a chosen effect.set [ v] effect to ()
— This sets the strength of a chosen effect.clear graphic effects
— This clears all effects over one sprite or the stage.
List of Graphical Effects
Color
This effect changes the hue (color) of the sprite.
Fisheye
This effect gives the impression of a sprite being seen through a wide-angle lens.
Whirl
This effect twists the sprite around its center point, therefore distorting the sprite.
Pixelate
This effect pixelates the sprite.
Brightness
This effect changes how desaturated the sprite is.
Ghost
This effect modifies the transparency of the sprite.
Mosaic
This effect shows multiple smaller images of the sprite, therefore creating a "mosaic" effect.
Value Limits
Some graphical effects have a limited range of values. Once an effect reaches its minimum or maximum, decrementing or incrementing it further does nothing.
Color
One costume can take on 200 different color-schemes using the color effect. The "real" effect of the color is equal to the original color plus half of the added color effect. This means that change [color v] effect by (200)
will do nothing since adding half of 200 to the original color would result in 100 being added to the color value, which will loop the color value back to its original color.
"Change color effect" will have a little apparent effect on sprites colored black, as black is a desaturated color rather than its own hue. To see the color effect on a black sprite, increase its brightness first. Similarly, sprites colored white will have little noticeable effect when the "Change color effect" block is used.
An easy way to explore color effects is to set the color effect to mouse x inside a forever loop:
forever set [color v] effect to (mouse x) end
By moving the mouse left and right, the user can see which x value matches each color effect.
Minimum Saturation and Brightness
In Scratch 3.0, the saturation and brightness of a sprite's color have a minimum when a color effect is applied, meaning that the saturation and brightness of a sprite may change when applying a color effect.[1]
Specifically, the saturation value of a sprite's color cannot be less than 9% after a color effect is applied. If a color effect is applied to a sprite with a saturation of less than 9%, then the sprite color's saturation will be increased to 9%. This is also true for a brightness of less than 5.5%.
This feature causes colors with little saturation or brightness to appear much more colorful and is especially noticeable on white and black.
The only exception on this limit is when the color effect is changed to 0, since Scratch will remove all color effects when the effect is changed to 0.
Infinite Color Effect
In Scratch 2.0 and beyond, when the color effect is set to Infinity or -Infinity, the sprite will lose all color and saturation, making the sprite appear grayscale. The new brightness of the sprite is based on the original sprite's brightness and saturation.
Fisheye
Any number whose absolute value is less than or equal to 3.4028234663852886×1024 will function correctly, although increasingly larger values will have no effect on the sprite at a certain point. Any number larger than 3.4028234663852886×1024 will cause the sprite to turn into an oval, confined by the bounding box of the sprite.
In Scratch 1.4, the value cannot be greater than 1073741723 or 230-101; attempting to input a value larger than this will cause the fisheye effect to not have any effect on the sprite. The minimum is -100,[2] which makes the costume take up part or all of its bounding box and have transparent and colored streaks emanating from the center, as shown in the picture on the left.
Whirl
Please expand this section. You can help by adding more information if you are an editor. More information might be found in a section of the talk page. (July 2022) |
Increasingly the whirl effect will cause an oval to appear, confined by the bounding box of the sprite. Any numbers larger than 1.94967423051954×1040, however, will affect the sprite differently. If a sprite appeared as four squares with colors blue, green, yellow, and red, respectively, it will appear differently depending on the operating system and browser.
Browser/OS | Windows 10/11 | MacOS 10/11 | MacOS 12/14 | Android 5 | Android 9 | Android 10 | Android 11 |
---|---|---|---|---|---|---|---|
Chrome | Blue | Red | Red | Unknown | Red | Blue, green, yellow, red, white | Blue |
Firefox | Blue, green, yellow, red | Blue, green, yellow, red | Blue, green, yellow, red, white | Blue, green, yellow, red, static, white | Blue, green, yellow, red, static, white | Blue, green, yellow, red | Unknown |
Safari | Blue, green, yellow, red | Blue, green, yellow, red | White | Unknown | Unknown | Unknown | Unknown |
Edge | Blue | Unknown | Red | Unknown | Unknown | Unknown | Unknown |
This limit is also present in Scratch 2.0, and the effect will also most likely behave differently depending on the operating system and browser.[citation needed]
In Scratch 1.4, its absolute value cannot be greater than 1,073,741,823 or 230-1. If this limit is reached, the rendered costume will revert to its original state. Backtracking by "changing" the effect by a negative number of "setting" it to a lower value will result in the effect functioning normally again.
Pixelate
There is no fixed limit for the pixelate effect. It should be noted that each costume will have a point at which increasing the pixelate effect will have no effect on the rendered image (when it disappears or is a uniformly colored rectangle with the original dimensions of the sprite/stage). If this effect is set to a negative number, the absolute value is used.
Brightness
This effect's minimum is -100 and the maximum is 100.[3] The costume will appear entirely black at -100 and white at 100. In Scratch 1.4, not all of the sprite will be brightened when set to 100.
Ghost
One costume can take on 100 different transparencies using the ghost effect. The minimum value is 0 and the maximum is 100.[4] Once the effect is equal to 100, the sprite is completely transparent and cannot be seen, but it still can be detected in some ways. This is useful for hiding sprites that still need to be detected, like an invisible platform in a platformer.
Mosaic
If this effect is set to a negative number, the absolute value is used. The largest possible value is 5105. This means that the largest amount of duplicates of a costume that can be generated with the mosaic effect is 262,144.
Example Uses
Color
- To change the sprite's color at some point in the project.
- To set the atmosphere in certain places in the project.
- To make the sprite a different color to signify a different thing.
- To make art by stamping in different colors.
- To make a sprite appear to be changing between the colors of a rainbow.
Fisheye
- To make the sprite distorted.
- To make a sprite appear as though it is moving towards or away from the screen.
- To make a sprite look fatter.
- Can be used as a transition between costumes.
- To make the sprite look as if it has been dented.
- To symbolize a black hole or singularity.
Whirl
- To make a sprite distorted.
- To symbolise time travel/teleportation/etc.
- To make a sprite look as though it is spinning.
- Can be used as a transition between costumes.
Pixelate
- To make a project look retro, or old-fashioned.
- Can be used as a transition between costumes.
- To block out, or censor, an ignored character in the scene.
- To transfer the sprite to pixel art.
Brightness
- To give the impression of glowing.
- To make something darker.
- Can be used as a transition between costumes.
- To highlight something (for example, an item that just appeared in a game).
Ghost
- Fading in and out.
- Giving the impression of a ghost.
- Making something disappear without using the hide block (with opacity set to 100).
- Mixing colors (with ghost effect 50 on two sprites).
- Can be used as a transition between costumes.
- As an alternative to reducing the brightness, by creating a half-transparent dark sprite over the original sprite.
- Ghosting a detector so the user cannot see the sprite but still be able to be detected by other sprites.
- Can make sprite slightly transparent to show a layer behind it.
Mosaic
- Multiplying a sprite without cloning.
- Can be used as a transition between costumes.
Removed Effects
This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective. |
Four additional effects were present in early Scratch 0.x versions. These effects are still functional in Scratch 1.4, although they cannot be accessed without editing the System Browser.
- Blur — blurs the sprite.
- Pointillize — picks random pixels and creates circles with their colors at those locations.
- Saturation — adds/removes color; saturation 0 is black and white.
- Water ripple — crashes Scratch due to a bug.[5]
Stage3D
This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective. |
In the early July 2013, Adobe updated Flash to version 11.8, removing hardware acceleration for Pixel Bender, which was used by Scratch to render graphic effects smoothly.[6] After this update, it was noticed by many Scratchers that the lag increased greatly when running graphic effect scripts.[7] Not only was Scratch affected by the lack of hardware acceleration, but almost all Flash applications using Pixel Bender also experienced the same issues and complications.[8]
This lag could be greatly reduced or diminished by downgrading to Adobe Flash version 11.7 and prior. The previous versions support hardware acceleration for Pixel Bender, which allows the graphical effects on Scratch and other Flash applications to run smoothly. The Scratch Team tried to develop a workaround to optimize smooth graphic effects without Pixel Bender, coming up with two possible solutions, both of which were unspecified.[9]
On August 30, 2013, an alternate, beta player, called Stage3D and still running in Flash, was released for testing.[10] It allowed one to enter the URL of a Scratch project and play it in the new player that was aimed toward reducing graphic effect lag. The current version of the player uses the faster Stage3D rendering engine by default when graphic effects other than ghost and brightness are used.
Issues
Stage3D sometimes renders vector images incorrectly, and it can cause vector files in projects to appear blurry. This can be fixed by removing all graphic effects blocks except ghost and brightness from the affected project.
Effect Inconsistencies
Some effects will render different results when used with either Stage3D or Pixel Bender. For example, the ghost effect will make the different layers of a vector sprite visible in Pixel Bender, while this will not happen in Stage3D. The effects that exhibit notable visual differences are:
- Fisheye: Sprites are more blurry in Pixel Bender.
- Whirl: Sprites whirl in different directions depending on the rendering engine.
- Brightness: A value of 100 will cause the sprite to become completely white in Pixel Bender, while it will still be visible in Stage3D.
- Ghost: Layers are visible for vector sprites in Stage3D.
Especially the ghost and brightness effects may confuse users as the results are dependent on the usage of other effects blocks in the project.[11]
Other
A ([ v] effect:: looks)
block is requested by many Scratchers.[12] It would be a reporter block and it is in some Scratch Modifications such as Explore.
References
- ↑ https://github.com/LLK/scratch-render/blob/ad1831ebfa308aab442bf2e37bad722273e8aa74/src/EffectTransform.js#L164-L179
- ↑ https://github.com/LLK/scratch-render/blob/ad1831e/src/ShaderManager.js#L100
- ↑ https://github.com/LLK/scratch-vm/blob/7eabcb8/src/blocks/scratch3_looks.js#L89-L95
- ↑ https://github.com/LLK/scratch-vm/blob/7eabcb8/src/blocks/scratch3_looks.js#L81-L87
- ↑ topic:427504
- ↑ topic:13395
- ↑ topic:14305
- ↑ https://web.archive.org/web/20160527163900/https://bugbase.adobe.com/index.cfm?event=bug&id=3591185
- ↑ post:119819
- ↑ topic:16671
- ↑ Stage3D
- ↑ nyan_nyan_nyan. (02/02/2013). "2.0 is pretty good, but there should totally be a “I____I effect” block." topic:1795