Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How can you calculate steeper curves than with a sine wave?
- the2000
-
Scratcher
1000+ posts
How can you calculate steeper curves than with a sine wave?
I'm currently working on a project which requires a lot of easing. A basic sine wave has worked for some parts, but most times I find myself needing a steeper curve. Unfortunately for my animation, I have a brain the size of a walnut, and can't figure out how to do this. I realize this is more of a math question, but still. How do I calculate a steeper curve?
- gor-dee
-
Scratcher
1000+ posts
How can you calculate steeper curves than with a sine wave?
Not quite sure what you mean by easing. What are you using the curve to do?
- the2000
-
Scratcher
1000+ posts
How can you calculate steeper curves than with a sine wave?
Not quite sure what you mean by easing. What are you using the curve to do?I'm terribly bad at explaining things, sorry.

The red line is a sine wave, how do I calculate something more like the blue line?
Last edited by the2000 (March 5, 2021 00:49:36)
- gor-dee
-
Scratcher
1000+ posts
How can you calculate steeper curves than with a sine wave?
y = (sin x)^1/3 looks quite good. Let me see how you would do that in Scratch…
Last edited by gor-dee (March 5, 2021 01:29:13)
- gor-dee
-
Scratcher
1000+ posts
How can you calculate steeper curves than with a sine wave?
set [X v] to [1]This works but only for positive half…
repeat ()
go to x: (X) y: ([e^ v] of (((1) / (3)) * ([ln v] of ([sin v] of (X))))) //e^ should be green
change [X v] by (1)
end
- the2000
-
Scratcher
1000+ posts
How can you calculate steeper curves than with a sine wave?
y = (sin x)^1/3 looks quite good. Let me see how you would do that in Scratch…Oh no… Curse you, Scratch's lack of exponents!!! (Seriously though, why don't they exist, they would take like five seconds to implement and save hours of programming)
Edit:
Positive half is all I'm probably going to need, actually.set [X v] to [1]This works but only for positive half…
repeat ()
go to x: (X) y: ([e^ v] of (((1) / (3)) * ([ln v] of ([sin v] of (X))))) //e^ should be green
change [X v] by (1)
end
Last edited by the2000 (March 5, 2021 02:13:06)
- FashionMaven
-
Scratcher
11 posts
How can you calculate steeper curves than with a sine wave?
What's a sine wave???
- the2000
-
Scratcher
1000+ posts
How can you calculate steeper curves than with a sine wave?
What's a sine wave???So imagine you're running around a circle. Now imagine that someone else is watching you from within a one dimensional plane. They can only see if something is moving left to right, not up or down. They would see that you're sort of swinging back and forth. That's basically what a sine wave is.
It worked! I'm not a fan of how long it has to be, but thanks so much for the solution! Do you want me to let you know when the project is done or are you not interested? I will give you credit.set [X v] to [1]This works but only for positive half…
repeat ()
go to x: (X) y: ([e^ v] of (((1) / (3)) * ([ln v] of ([sin v] of (X))))) //e^ should be green
change [X v] by (1)
end
- u8y7541
-
Scratcher
59 posts
How can you calculate steeper curves than with a sine wave?
I found that the function y = sin((pi/2) * sin(x)) works very well, and I think it's the shape that you're looking for. If you want it to be even steeper, you can just compose the function with itself, giving you y = sin((pi/2) * sin((pi/2) * sin(x))). Here's a link to a graph comparing the normal sine wave with these two alternatives. Hope this helped.
- the2000
-
Scratcher
1000+ posts
How can you calculate steeper curves than with a sine wave?
I found that the function y = sin((pi/2) * sin(x)) works very well, and I think it's the shape that you're looking for. If you want it to be even steeper, you can just compose the function with itself, giving you y = sin((pi/2) * sin((pi/2) * sin(x))). Here's a link to a graph comparing the normal sine wave with these two alternatives. Hope this helped.I just got finished implementing the other workaround but I'll give this one a shot tomorrow(?)
- gor-dee
-
Scratcher
1000+ posts
How can you calculate steeper curves than with a sine wave?
It worked! I'm not a fan of how long it has to be, but thanks so much for the solution! Do you want me to let you know when the project is done or are you not interested? I will give you credit.Thanks, no need for credit but I'm intrigued as to what you are doing, so I'd love to see it when it's done. However, I looked at @u8y7541's solution and it looks much more like what you were after!
- Discussion Forums
- » Help with Scripts
-
» How can you calculate steeper curves than with a sine wave?



