This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-11-16 21:59:54

CatScratchar
Scratcher
Registered: 2009-11-10
Posts: 33

I need help with the "fade" effect.

I've noticed that a few projects show objects fading. I have absolutely no clue even how to change the opacity of an object.

Offline

 

#2 2009-11-16 22:03:09

adriangl
Scratcher
Registered: 2007-07-02
Posts: 1000+

Re: I need help with the "fade" effect.

<when green flag clicked><set[ ghost ]effect to(0)<change[ ghost ]effect by( 100)

Hopefully this helps.

Last edited by adriangl (2009-11-16 22:04:35)


Scratchin' since 2007

Offline

 

#3 2009-11-16 23:36:46

greenflash
Scratcher
Registered: 2009-05-27
Posts: 1000+

Re: I need help with the "fade" effect.

Use the ghost effect. If the ghost effect is at 0, the object is opaque. If the ghost effect is at 100, the object is transparent.

To fade in, the ghost effect is at 100 and we want it to reach 0. So we will decrease the ghost effect by a little bit each time. (A good number to use is four). Now that you know what number your "little bit" is, you have to repeat this process a certain number of times until it reaches zero. (For four, that would be 25 because 25*4=100)

Use the script
[blocks]
<repeat( 25
<change[ ghost ]effect by( -4
[/blocks]
Remeber that negitives decrease the number.


To fade out, the ghost effect is at 0 and we want it to reach 100. So we will increase the ghost effect by a little bit each time. (A good number to use is four). Now that you know what number your "little bit" is, you have to repeat this process a certain number of times until it reaches zero. (For four, that would be 25 because 25*4=100)

Use the script
[blocks]
<repeat( 25
<change[ ghost ]effect by( 4
[/blocks]
Remeber that positives increase the number

Hopefully that helps!  big_smile


http://i48.tinypic.com/2wrkirk.pnghttp://i46.tinypic.com/6r5zk7.pnghttp://i45.tinypic.com/2vtxr1t.png

Offline

 

#4 2009-11-16 23:57:23

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: I need help with the "fade" effect.

If you're doing what greenflash says, remember this: You can also change the amounts. Just make sure that the repeat count and the change amount multiplied together make a hundred!


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#5 2009-11-17 13:25:21

CatScratchar
Scratcher
Registered: 2009-11-10
Posts: 33

Re: I need help with the "fade" effect.

Thanks guys.  big_smile  It helped tons.

Offline

 

#6 2009-11-17 19:09:32

Larry828
Scratcher
Registered: 2007-05-30
Posts: 100+

Re: I need help with the "fade" effect.

Chrischb wrote:

If you're doing what greenflash says, remember this: You can also change the amounts. Just make sure that the repeat count and the change amount multiplied together make a hundred!

And if you want the fade in/out to happen more slowly, you can add "Wait 0.1 seconds" inside the Repeat block. (Or any Wait amount....)

Offline

 

#7 2009-11-19 18:29:08

switenky
Scratcher
Registered: 2009-06-28
Posts: 100+

Re: I need help with the "fade" effect.

Code:

<when green flag clicked>
<set[ ghost ]effect to( 0
<repeat( 100
<change[ ghost ]effect by( 1

To fade away

Code:

<when green flag clicked>
<set[ ghost ]effect to( 100
<repeat( 100
<change[ ghost ]effect by( -1

To fade appear
Hopefully this help!


http://scratch.mit.edu/static/projects/switenky/769464_med.png DIG DUG

Offline

 

Board footer