Discuss Scratch

Undyne628
Scratcher
5 posts

How do I make a sprite fade in?

Okay. I have no idea how to make a sprite fade in as in gradually appear. Any help as to do it?

Thanks!
Undyne628
codeman1044
Scratcher
1000+ posts

How do I make a sprite fade in?

There's a block to do that:
changeGhosteffectby
For the ghost effect, negative numbers (-1, -2, -3) will make the image more opaque, while positive values make it more transparent. To fade in, just write this script:
whenclickedsetGhosteffectto100repeat50changeGhosteffectby2this number should be 100 divided by the repeat numberchange this number to slow down how fast you want it to appear
hope this helps!
Undyne628
Scratcher
5 posts

How do I make a sprite fade in?

codeman1044 wrote:

There's a block to do that:
changeGhosteffectby
For the ghost effect, negative numbers (-1, -2, -3) will make the image more opaque, while positive values make it more transparent. To fade in, just write this script:
whenclickedsetGhosteffectto100repeat50changeGhosteffectby2this number should be 100 divided by the repeat numberchange this number to slow down how fast you want it to appear
hope this helps!
I'm sooo sorry! It did not work for me… but I will try again!!!

Last edited by Undyne628 (March 24, 2019 19:57:33)

-SystemError-
Scratcher
59 posts

How do I make a sprite fade in?

Mindlessly adding on to codeman1044's script, here is a super-smooth fade-in velocity script.

whenclickedrepeatuntilfloorofghosteffect=0changeghost effectby0-ghosteffect/0whenclickedforeversetghosteffecttoghosteffect
codeman1044
Scratcher
1000+ posts

How do I make a sprite fade in?

I actually made an error in the code.
Under the change ghost effect block, it should be a negative 2, not positive. That issue was my fault. Sorry!
.-.
Also,

-SystemError- wrote:

Mindlessly adding on to codeman1044's script, here is a super-smooth fade-in velocity script.

whenclickedrepeatuntilfloorofghosteffect=0changeghost effectby0-ghosteffect/0whenclickedforeversetghosteffecttoghosteffect
Couldn't you just do this:
whenclickedrepeatuntilfloorofghosteffect=0changeghost effectby0-ghosteffect/0setGhosteffecttoghosteffectsetGhosteffecttoghosteffect
instead of running another block? adding another block makes it harder to optimize

Last edited by codeman1044 (March 24, 2019 20:05:01)

Undyne628
Scratcher
5 posts

How do I make a sprite fade in?

-SystemError- wrote:

Mindlessly adding on to codeman1044's script, here is a super-smooth fade-in velocity script.

whenclickedrepeatuntilfloorofghosteffect=0changeghost effectby0-ghosteffect/0whenclickedforeversetghosteffecttoghosteffect
I am confused about the variable thing : ghost effect. How does that work???

Undyne628
Scratcher
5 posts

How do I make a sprite fade in?

Please help! I am making a project where a sprite fades out and then I want it to fade in. I guess the other strategies won't work because of that. IHNC where this is going to take me, but I need to do whatever I can to make my project a success!

Thanks!
Undyne628

P.S. IHNC means I have no clue in case you didn't know

Last edited by Undyne628 (March 24, 2019 20:29:40)

Undyne628
Scratcher
5 posts

How do I make a sprite fade in?

Wait! It works now! Thank you guys!!! Ur the best! It was a good idea starting this discussion. But… it turns out I don't need it! But now I know! THANKS AGAIN!!!

Thank you so much with great honor and stuffs,
Undyne628

Last edited by Undyne628 (March 24, 2019 20:45:10)

HighRebornDragon
Scratcher
13 posts

How do I make a sprite fade in?

whenclickedsetghosteffectto100repeat10change ghosteffectby-10
DogeDoodles
Scratcher
12 posts

How do I make a sprite fade in?

HighRebornDragon wrote:

whenclickedsetghosteffectto100repeat10change ghosteffectby-10

Please don't necropost. This Discussion is a little less than a year old.

Last edited by DogeDoodles (Nov. 18, 2020 21:40:33)

Aimbridge
Scratcher
4 posts

How do I make a sprite fade in?

Hi,

I'm Dennis, and I've been working on an intro. Even though I have got the basics of fading down, I need it to fade in while in-sync with a little music that I added in the background. The point is, it's going too slowly. It fades in by -1 every 0.1 seconds, but even with the choice of making -1 into -10, which I understand would fix the issue, it just looks terrible afterwards. If anybody has any clue on how to make it fade in smoothly on Scratch 3.0 (the other tips are outdated), then please respond. Thanks

-Dennis/Aimbridge
Aimbridge
Scratcher
4 posts

How do I make a sprite fade in?

Hi,

I'm back. After a bit of testing, I got a super short line of code that has a perfect fade in. Here it is:

whenclickedchangeghosteffectby100

whenclickedwait1secsrepeat100changeghosteffectby-1

Hope this helped!
-Dennis/Aimbridge

EDIT: Hey, I'm back, just forgot to mention: THIS WORKS WITH SCRATCH 3.0! The other messages were outdated and were only compatible with Scratch 2.0, so just wanted to point that out.
Cheers!
-Dennis/Aimbridge

Last edited by Aimbridge (Feb. 2, 2021 19:38:41)

Aimbridge
Scratcher
4 posts

How do I make a sprite fade in?

Aimbridge wrote:

Hi,

I'm back. After a bit of testing, I got a super short line of code that has a perfect fade in. Here it is:

whenclickedchangeghosteffectby100

whenclickedwait1secsrepeat100changeghosteffectby-1

Hope this helped!
-Dennis/Aimbridge

EDIT: Hey, I'm back, just forgot to mention: THIS WORKS WITH SCRATCH 3.0! The other messages were outdated and were only compatible with Scratch 2.0, so just wanted to point that out.
Cheers!
-Dennis/Aimbridge


EDIT 2: Me again, I just wanted to say that after a bit more testing, I figured out how you could add a fade out effect at the end. NOTE: All of the lines of script that I'm about to show you MUST GO AFTER THE FADE IN EFFECT! Otherwise your not running it, since you don't have a ‘When flag clicked’ block. Also, if you don't put it at the end and put it under a different ‘When flag clicked’ block, your going to mess up the fade in script, since both of them are going to wait 1 second and then do the same function just oppositely at the same time. DO NOT FORGET TO PUT THIS SCRIPT AT THE END OF YOUR FADE IN SCRIPT!

wait1secsrepeat100changeghosteffectby1

Just another quick note: Only difference that I made here was switching the -1 at the end of change ghost effect to a 1, so that way instead of fading in 100 times, it was fading out 100 times.
Have a good one!
-Dennis/Aimbridge
Rohancg
Scratcher
72 posts

How do I make a sprite fade in?

whenclickedsetghosteffectto100repeat20changeghosteffectby5
MissElvisUk
Scratcher
1 post

How do I make a sprite fade in?

All of these where so help full

Powered by DjangoBB