Sin: Difference between revisions
Nikitaivanov (talk | contribs) (Created page with "Compute sine of an angle in degrees. File:Sin1.png == Input/Ouput == Sine outputs value between 1 and -1 depending on the given value to it which scales from angular (0°–360°), though values outside this range work as well. == Notes == Additionally, there are only 4 certain points where you can get a whole number: * 0°/360° = 0 * 90° = 1 * 180° = 0 * 270° = -1 To understand better search for "[https://www.google.com/search?q=trigonometric+functions|Trig...") |
RandomName (talk | contribs) No edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Block | |||
|image=Sin.png | |||
|type=s | |||
|folder=Math | |||
|input1={{Port|n|Num}} | |||
|output1={{Port|n|Sin(Num)}} | |||
}} | |||
[ | Computes [https://en.wikipedia.org/wiki/Sine sine] of an angle in degrees. | ||
== Notes == | |||
The output is clipped from -1 to 1. Within a full revolution, there are four points which output a whole number: | |||
* 0°/360° = 0 | * 0°/360° = 0 | ||
* 90° = 1 | * 90° = 1 | ||
Line 14: | Line 18: | ||
* 270° = -1 | * 270° = -1 | ||
== Example == | |||
Ever wondered how to make those ultra smooth floating coin animations like in Roper? Here's how to do it: | Ever wondered how to make those ultra smooth floating coin animations like in Roper? Here's how to do it: | ||
{{Image|Sin_example_coin_animation.png}} | |||
* Sin and [[Cos]] can be used for such back and forth animations like this. You can also multiply the output of sin or cos by a number to move it in a larger or smaller scale. If you manage to utilize this function, you can even make any type of animations very smooth (e.g. walking animation, gun Recoil animation, moving platforms, etc.)! | * Sin and [[Cos]] can be used for such back and forth animations like this. You can also multiply the output of sin or cos by a number to move it in a larger or smaller scale. If you manage to utilize this function, you can even make any type of animations very smooth (e.g. walking animation, gun Recoil animation, moving platforms, etc.)! | ||
[[Category:Blocks]] | [[Category:Blocks]] |
Latest revision as of 14:07, 3 June 2024
Sin
Type | Script block |
Collider | None |
Folder | Math |
Ports | |
---|---|
Inputs | Num |
Outputs | Sin(Num) |
Computes sine of an angle in degrees.
Notes
The output is clipped from -1 to 1. Within a full revolution, there are four points which output a whole number:
- 0°/360° = 0
- 90° = 1
- 180° = 0
- 270° = -1
Example
Ever wondered how to make those ultra smooth floating coin animations like in Roper? Here's how to do it:

- Sin and Cos can be used for such back and forth animations like this. You can also multiply the output of sin or cos by a number to move it in a larger or smaller scale. If you manage to utilize this function, you can even make any type of animations very smooth (e.g. walking animation, gun Recoil animation, moving platforms, etc.)!