Sin: Difference between revisions

From Fancade Wiki
m (Use infobox, slightly remove clutter)
m (Correct to Image template)
Line 22: Line 22:
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:


[[File:Sin_example_coin_animation.jpg]]
{{Image|Sin_example_coin_animation.png}}


(Note that you don't have to store the input in a rotation. A number or [[Current Frame]] will do just fine.)
(Note that you don't have to store the input in a rotation. A number or [[Current Frame]] will do just fine.)

Revision as of 18:27, 21 May 2024

Sin
Sin.png
TypeScript block
ColliderNone
FolderMath
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_example_coin_animation.png

(Note that you don't have to store the input in a rotation. A number or Current Frame will do just fine.)

  • 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.)!