6
\$\begingroup\$

When creating a sprite animation in Aseprite, we can set the "Duration (milliseconds)", as show here:

enter image description here

But when setting up the animation in Unity, we have to specify "Samples" as shown here:

enter image description here

How can we convert from "Duration" to "Samples"?

\$\endgroup\$

1 Answer 1

10
\$\begingroup\$

The "Samples" field is short for "Samples per Second"

It is not measuring a duration or length of an animation or frame like your Aseprite example. It's a sampling frequency, determining how close together or far apart the snapping "ticks" on the timeline should be.

So if you've set your "Samples" to the default 60, then each tick on the animation timeline represents one sixtieth of a second, or about 16.6667 milliseconds.

A 110 millisecond duration would then be 110 ÷ 16.6667 = 6.666 ≈ 7 ticks long on the timeline.

To make your life simple, you could set your "Samples" to 1000, then each tick is exactly one millisecond, and you can copy over your keyframe positions unchanged from a program that presents them in millisecond timings. So a 110 ms duration would be 110 timeline ticks.

If all of your frames have a 110 ms duration, and you want each one to be a single tick on the timeline, you can divide:

$$1000 \frac {\text{ms}} {\text{second}} \div 110 \frac {\text{ms}} {\text{sample}} = 9.090909... \frac {\text{samples}} {\text{second}}$$

So you can approximate this by putting a 9 in the "Samples" field.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .