banner



How To Make A Good Animation On Scratch

There are ii types of animating.
1) costume animative
You make unlike costumes and move the things in the costumes slightly. And so you use this code to go on switching costumes so information technology animates

echo (a couple of times)

adjacent costume
finish

This gives an event like an animated gif image.
The reward is that yous can exercise more complex stuff with less piece of work, but the disadvantages are that switching costumes is laggy, and so your animation will exist. You have less time control, and it won't really sync with other sprites. Also, at that place is no solution for making information technology frame rate independent, and then it volition always run slower on dull pc s and faster on faster pc s

For this reason, I'thou not a big fan of it. I like more than to code my animations, which is selection two

two) coding your animations.

I call up this is the manner to go. I've got a lot of experience with this, because I employ it all the fourth dimension.
Coding animations can exist equally easy as this:

echo (100)
change size past (1)
cease

which changes the size past 100

or for fading out

repeat (100)
change [ghost five] issue by (1)
end

This is very elementary, but I wouldn't recommend to use information technology in serious animations where everything needs to exist 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 and so on a pc that's slower, and so it will mess upward the timing with other sprites and the music.
Fixing this is a lot more complex, and if y'all don't care how it works, simply movement on to the next section (with a link to my animation tools that make your life easier)

The only animation that is easy to brand frame rate contained, is motion. Yous can do this by using the built in 'glide' block. (gee, no one knows about that block :O)
Cake i: move on x and y
Block two: move on x merely
Block three: move on y only

glide (1) secs to x: (100) y: (100)
glide (ane) secs to ten: (100) y: (y position)
glide (one) secs to x: (ten position) y: (100)

The dandy advantage of using this block, is that yous can choose how long the movement will take exactly (frame charge per unit independence! badum tsss)

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

In that location are two ways to make it perfectly frame rate independent:

1) Timer trick.
I think this is the best way to practice this. You lot calculate the percent completed of your animation based on the elapsed time.
The formula is quite complicated, just once you lot get information technology, 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 lot just set up size to startSize + the time pct of the total change.

This is a fashion to do it:

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

2) delta timing (non tested, simply should work)
Delta timing is timing the time betwixt ii 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 y'all don't want to command the animation by time, but past a speed value

when green flag clicked
fix [toSize v] to [150]
set [speed v] to [1000]
prepare [delta-timer v] to (timer)
repeat until <(size) = (toSize)>
set [delta-time 5] to ((timer) - (delta-timer))
set [delta-timer v] to (timer)
if <((size) + ((delta-time) * (speed))) < (toSize)> then
modify size by ((delta-fourth dimension) * (speed))
else
set up size to (toSize) %
stop
end

____

But! Yous don't have to practise this all yourselves! I made a projection with a gear up of custom blocks that practice this all for you! Isn't that great?
The projection is called DCAP: "Dancing True cat Blitheness 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 fabricated this project), and then it volition make your life easier!
Here's a link: https://scratch.mit.edu/projects/55855726/

I promise it helped!

Source: https://scratch.mit.edu/discuss/post/991080/

Posted by: carmonaoffirest1957.blogspot.com

0 Response to "How To Make A Good Animation On Scratch"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel