Discuss Scratch

Cutedaisy24
Scratcher
100+ posts

How to make animations on scratch ?

How to make an animation with synchronized music in it?
lederniersamourai
Scratcher
500+ posts

How to make animations on scratch ?

Have a look at this one, recently featured by the scratch team: I like vegetables
It seems that there is no magic: just find and test the duration of each animation step.
You can create tools for discovring the time arrangement:
1) a split timer
2) a beep timer: it will beep at the recorded times in th elis and you can hear if you are correctly in sync

Each one is easily done with on script and one list
Cutedaisy24
Scratcher
100+ posts

How to make animations on scratch ?

lederniersamourai wrote:

Have a look at this one, recently featured by the scratch team: I like vegetables
It seems that there is no magic: just find and test the duration of each animation step.
You can create tools for discovring the time arrangement:
1) a split timer
2) a beep timer: it will beep at the recorded times in th elis and you can hear if you are correctly in sync

Each one is easily done with on script and one list
Thanks alot, but i need a little help with the script too, because i almost know nothing about this . I am not such an advanced Scratcher, sorry.
Cutedaisy24
Scratcher
100+ posts

How to make animations on scratch ?

Anyone?
mammut1234
Scratcher
3 posts

How to make animations on scratch ?

Here is the Answer!

when green flag clicked
repeat (This is optional... you dont need to reapeat)
glide (All these just represent the animation) secs to x: (0) y: (0)
glide (All these just represent the animation) secs to x: (0) y: (0)
glide (All these just represent the animation) secs to x: (0) y: (0)
glide (All these just represent the animation) secs to x: (0) y: (0)


end

Just play withe the timing.
You can add
wait (1) secs
if you want. you can change the variables to look like somthing like this:
wait (1.67) secs

Thanks and keep scratching!!!
supercoolgum
Scratcher
56 posts

How to make animations on scratch ?

I've also had trouble with this, and no one has given me a solid answer. I think the best way is to find out from an experienced animator or just find out yourself!

What I would do if I were you, I would first draw all the art that I want for the animation, then upload it as a sprite. As for the music, I have seen many Scratchers divide their music into sections so then the animation would go more smoothly.

Most of making animations consists of just normal common sense. If you need a sprite to go to the other side of the screen, use the glide block. If you want them to wait before switching to another costume, use the wait block. I would check out some of @Silvershimmer43's animations to see what she does.

Hope this helps, and Scratch on!
ScratchinJoJo
Scratcher
100+ posts

How to make animations on scratch ?

There are two types of animating.
1) costume animating
You make different costumes and move the things in the costumes slightly. Then you use this code to keep switching costumes so it animates
repeat (a couple of times)

next costume
end

This gives an effect like an animated gif image.
The advantage is that you can do more complex stuff with less work, but the disadvantages are that switching costumes is laggy, and so your animation will be. You have less time control, and it won't really sync with other sprites. Also, there is no solution for making it frame rate independent, so it will always run slower on slow pc s and faster on faster pc s

For this reason, I'm not a big fan of it. I like more to code my animations, which is option 2

2) coding your animations.

I think this is the way to go. I've got a lot of experience with this, because I use it all the time.
Coding animations can be as easy as this:
repeat (100)
change size by (1)
end
which changes the size by 100

or for fading out
repeat (100)
change [ghost v] effect by (1)
end

This is very simple, but I wouldn't recommend to use it in serious animations where everything needs to be synced perfectly.
The problem is that this code isn't frame rate independent, and if your pc is very fast, the animation will be done faster then on a pc that's slower, and so it will mess up the timing with other sprites and the music.
Fixing this is a lot more complex, and if you don't care how it works, just move on to the next section (with a link to my animation tools that make your life easier)

The only animation that is easy to make frame rate independent, is movement. You can do this by using the built in ‘glide’ block. (gee, no one knows about that block :O)
Block one: move on x and y
Block two: move on x only
Block three: move on y only
glide (1) secs to x: (100) y: (100)
glide (1) secs to x: (100) y: (y position)
glide (1) secs to x: (x position) y: (100)
The great advantage of using this block, is that you can choose how long the movement will take exactly (frame rate independence! badum tsss)

You got now what I exactly mean by frame rate independence? Alright! Now let's really make something!

There are two ways to make it perfectly frame rate independent:

1) Timer trick.
I think this is the best way to do this. You calculate the percentage completed of your animation based on the elapsed time.
The formula is quite complicated, but once you get it, it's peanuts
This is the formula:

Size = startSize + ((toSize - size) * (timer - timer-reset) / animation-seconds)

Which actually means:

Size = startSize + (total-change * elapsed-time / animation-seconds)

So you just set size to startSize + the time percentage of the total change.

This is a way to do it:

when green flag clicked
set [toSize v] to [150]
set [startSize v] to (size)
set [animation-seconds v] to [1]
set [timer-reset v] to (timer)
repeat until <(size) = (toSize)>
if <(toSize) > ((startSize)+(((toSize)-(startSize))*(((timer)-(timer-reset))/(animation-seconds))>
set size to ((startSize)+(((toSize)-(startSize))*(((timer)-(timer-reset))/(animation-seconds)))) %
else
set size to (toSize)
end

2) delta timing (not tested, but should work)
Delta timing is timing the time between two frames, or repeats or whatever. This is usually a very small number that you can use in your ‘change by …’ Block.
Choose this one if you don't want to control the animation by time, but by a speed value

when green flag clicked
set [toSize v] to [150]
set [speed v] to [1000]
set [delta-timer v] to (timer)
repeat until <(size) = (toSize)>
set [delta-time v] to ((timer) - (delta-timer))
set [delta-timer v] to (timer)
if <((size) + ((delta-time) * (speed))) < (toSize)> then
change size by ((delta-time) * (speed))
else
set size to (toSize) %
end
end
____

But! You don't have to do this all yourselves! I made a project with a set of custom blocks that do this all for you! Isn't that great?
The project is called DCAP: “Dancing Cat Animation Platform”. It contains blocks like this:

zoom to size (50) % in (1) seconds ::custom
whirl from (0) to (250) in (2) seconds ::custom
rotate (360) degrees to the left in (0.5) seconds ::custom

and a lot more! It really made my life easier (I always use it when I animate something after I made this project), and so it will make your life easier!
Here's a link: https://scratch.mit.edu/projects/55855726/

I hope it helped!

Last edited by ScratchinJoJo (May 13, 2015 18:50:01)

Cutedaisy24
Scratcher
100+ posts

How to make animations on scratch ?

ScratchinJoJo wrote:

There are two types of animating.
1) costume animating
You make different costumes and move the things in the costumes slightly. Then you use this code to keep switching costumes so it animates
repeat (a couple of times)

next costume
end

This gives an effect like an animated gif image.
The advantage is that you can do more complex stuff with less work, but the disadvantages are that switching costumes is laggy, and so your animation will be. You have less time control, and it won't really sync with other sprites. Also, there is no solution for making it frame rate independent, so it will always run slower on slow pc s and faster on faster pc s

For this reason, I'm not a big fan of it. I like more to code my animations, which is option 2

2) coding your animations.

I think this is the way to go. I've got a lot of experience with this, because I use it all the time.
Coding animations can be as easy as this:
repeat (100)
change size by (1)
end
which changes the size by 100

or for fading out
repeat (100)
change [ghost v] effect by (1)
end

This is very simple, but I wouldn't recommend to use it in serious animations where everything needs to be synced perfectly.
The problem is that this code isn't frame rate independent, and if your pc is very fast, the animation will be done faster then on a pc that's slower, and so it will mess up the timing with other sprites and the music.
Fixing this is a lot more complex, and if you don't care how it works, just move on to the next section (with a link to my animation tools that make your life easier)

The only animation that is easy to make frame rate independent, is movement. You can do this by using the built in ‘glide’ block. (gee, no one knows about that block :O)
Block one: move on x and y
Block two: move on x only
Block three: move on y only
glide (1) secs to x: (100) y: (100)
glide (1) secs to x: (100) y: (y position)
glide (1) secs to x: (x position) y: (100)
The great advantage of using this block, is that you can choose how long the movement will take exactly (frame rate independence! badum tsss)

You got now what I exactly mean by frame rate independence? Alright! Now let's really make something!

There are two ways to make it perfectly frame rate independent:

1) Timer trick.
I think this is the best way to do this. You calculate the percentage completed of your animation based on the elapsed time.
The formula is quite complicated, but once you get it, it's peanuts
This is the formula:

Size = startSize + ((toSize - size) * (timer - timer-reset) / animation-seconds)

Which actually means:

Size = startSize + (total-change * elapsed-time / animation-seconds)

So you just set size to startSize + the time percentage of the total change.

This is a way to do it:

when green flag clicked
set [toSize v] to [150]
set [startSize v] to (size)
set [animation-seconds v] to [1]
set [timer-reset v] to (timer)
repeat until <(size) = (toSize)>
if <(toSize) > ((startSize)+(((toSize)-(startSize))*(((timer)-(timer-reset))/(animation-seconds))>
set size to ((startSize)+(((toSize)-(startSize))*(((timer)-(timer-reset))/(animation-seconds)))) %
else
set size to (toSize)
end

2) delta timing (not tested, but should work)
Delta timing is timing the time between two frames, or repeats or whatever. This is usually a very small number that you can use in your ‘change by …’ Block.
Choose this one if you don't want to control the animation by time, but by a speed value

when green flag clicked
set [toSize v] to [150]
set [speed v] to [1000]
set [delta-timer v] to (timer)
repeat until <(size) = (variable-size)>
set [delta-time v] to ((timer) - (delta-timer))
set [delta-timer v] to (timer)
if <((size) + ((delta-time) * (speed))) < (toSize)> then
change size by ((delta-time) * (speed))
else
set size to (toSize) %
end
end
____

But! You don't have to do this all yourselves! I made a project with a set of custom blocks that do this all for you! Isn't that great?
The project is called DCAP: “Dancing Cat Animation Platform”. It contains blocks like this:

zoom to size (50) % in (1) seconds ::custom
whirl from (0) to (250) in (2) seconds ::custom
rotate (360) degrees to the left in (0.5) seconds ::custom

and a lot more! It really made my life easier (I always use it when I animate something after I made this project), and so it will make your life easier!
Here's a link: https://scratch.mit.edu/projects/55855726/

I hope it helped!

Yes it helped !
Thanks!

BTM27
Scratcher
9 posts

How to make animations on scratch ?

I need to know how to!!!!!!!!!
when green flag clicked
say [help on my animation] for (2) secs
switch costume to [ oh no the world is ending]
forever
freak out
play sound [ AHHHHHHHHHHH!!!!!!!!!!!!!] until done
:)oh that was sarcastic
if you do I will follow you for life
set [ you are awesome] to [1000000000000000]
hello for my animation
if <key [ animation time] pressed?> then
say [HOORAY!!!!!!!!] for (100) secs
end

Last edited by BTM27 (April 13, 2019 15:18:41)

14152cool
Scratcher
100+ posts

How to make animations on scratch ?

yes, you do. make your own topic please. you brought this old topic to the front page
BTM27
Scratcher
9 posts

How to make animations on scratch ?

when green flag clicked
wait until <green flag clicked>
broadcast [help is on the way]






when I receive [help is on the way]
say [YAHOOOOOOOO] for (10) secs
Kraken_Games
Scratcher
100+ posts

How to make animations on scratch ?

BTM27 wrote:

I need to know how to!!!!!!!!!
when green flag clicked
say [help on my animation] for (2) secs
switch costume to [ oh no the world is ending]
forever
freak out
play sound [ AHHHHHHHHHHH!!!!!!!!!!!!!] until done
:)oh that was sarcastic
if you do I will follow you for life
set [ you are awesome] to [1000000000000000]
hello for my animation
if <key [ animation time] pressed?> then
say [HOORAY!!!!!!!!] for (100) secs
end

BTM27 wrote:

when green flag clicked
wait until <green flag clicked>
broadcast [help is on the way]




when I receive
say for (10) secs

Please don't spam or necropost or blockspam - you are doing all three.

Powered by DjangoBB