Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to use sin, cos, abs, etc? I need help
- esimas123
-
Scratcher
27 posts
How to use sin, cos, abs, etc? I need help
Hi Scratchers! I need help with some math blocks, like sin, cos, and abs. I don't quite understand how to use them in my projects and I'd like to know in what kind of situations they would be useful.
say (i need help with([abs v] of (0)::operators)([Sin v] of (0)::operators)([cos v] of (0)::operators)([etc v] of (0)::operators) pls help )
- 8to16
-
Scratcher
1000+ posts
How to use sin, cos, abs, etc? I need help
Last edited by 8to16 (Nov. 9, 2024 20:10:29)
- griefercube
-
Scratcher
500+ posts
How to use sin, cos, abs, etc? I need help
sin: sine function. It gives a smooth wave as you input numbers from 0 to 360. (The range is -1 to 1)
Cos: cosine function, its sin but +90
abs: absolute value. Basically the positive equivalent of a number (abs(-5)=5)
Cos: cosine function, its sin but +90
abs: absolute value. Basically the positive equivalent of a number (abs(-5)=5)
- griefercube
-
Scratcher
500+ posts
How to use sin, cos, abs, etc? I need help
Sin and cos can be used for rotating sprites using coordinates or smooth transitions/size because of its circular nature. Abs can be used to find and compare the “size” of numbers.
You’ll learn to use tan, sqrt, e^, and ln soon enough.
You’ll learn to use tan, sqrt, e^, and ln soon enough.
- TheCreatorOfUnTV
-
Scratcher
1000+ posts
How to use sin, cos, abs, etc? I need help
([abs v] of (9)::operators)turns negative numbers positive while keeping positive numbers untouched. Useful when you want to make all numbers have the same sign.
([sqrt v] of (9)::operators)gets the positive square root of a number and is almost the opposite of multiplying a number by itself (the exception being it doesn't know if the root was negative.) It's mainly used for calculating distances.
([sin v] of (9)::operators)return different properties of a right triangle where the long side is of length 1, and one of the angles is the number being input. SINe is the vertical position of the unknown point, and COSine is the horizontal position of the unknown point. TANgent is the slope from the known point to the unknown point. These are often used for circular motion and move 10 steps is based on this block and a few others.
([cos v] of (9)::operators)
([tan v] of (9)::operators)
([asin v] of (9)::operators)These are the opposites of the last three blocks mentioned. Atan is used in pointing to a position.
([acos v] of (9)::operators)
([atan v] of (9)::operators)
([e^ v] of (9)::operators)10 ^ is 10 raised to the power of the number input (that is, 10 is multiplied by itself the number of times the input says). e ^ gives the number that is close to, but not exactly, 2.718…, raised to the power of the number input. Mainly used with their inverses for working around the lack of exponent blocks, as their other usage (calculus, which is even harder than these blocks) is relatively rare in Scratch, since it is not fast enough for the advanced simulation or 3D projects that absolutely need it.
([10^ v] of (9)::operators)
([ln v] of (9)::operators)These are the opposites of the last two blocks already mentioned. Used for the same reasons as the last two mentioned, and also helpful for calculating the number of digits a number has in a specific base.
([log v] of (9)::operators)
([ceiling v] of (9)::operators)These round numbers up and down, respectively. Useful when you want the number to always round one way and not the other.
([floor v] of (9)::operators)
Last edited by TheCreatorOfUnTV (Nov. 9, 2024 23:49:11)
- griefercube
-
Scratcher
500+ posts
How to use sin, cos, abs, etc? I need help
The
([atan v] of ()::operators)block can also be used to make a sprite point towards a specified coordinate.
- THEIMPORTANT
-
Scratcher
500+ posts
How to use sin, cos, abs, etc? I need help
you probably wont use sin cos and tan if you are not watching a griffpatch video tbh
- LeonSONICid
-
Scratcher
3 posts
How to use sin, cos, abs, etc? I need help
hɘll0
how to use
how to use
([abs v] of ( )::operators)block
([abs v] of (-10)::operators)=
((-10) + ((10) * (2)))now bʏə
- Underwhite
-
Scratcher
100+ posts
How to use sin, cos, abs, etc? I need help
([abs v] of (-90)::operators) // This represents absolute value. you just make the negative number a positive number. Doesn't do anything for positive numbers.^^
([sin v] of (-90)::operators) // This represents sine. If you know you know. Most commonly used to make smooth glides like the example below:
set y to ([sin v] of ((((timer) * (How fast you want the animation :: #000000)) * (How big the idk I forgor- :: #000000)) + (again I forgort :: #000000)
[sqrt v] of (insert number :: #000000)
gets the positive square root of a number and is almost the opposite of multiplying a number by itself (the exception being it doesn't know if the root was negative.) It's mainly used for calculating distances.
Check the other comments or the Scratch Wiki for more! I'm done!
-UnderwhiteLast edited by Underwhite (Nov. 10, 2024 07:20:05)
- esimas123
-
Scratcher
27 posts
How to use sin, cos, abs, etc? I need help
I already know how to use it, I don't need anything else /:
- Connerfurr13
-
Scratcher
52 posts
How to use sin, cos, abs, etc? I need help
([abs v] of (9)::operators)
This is for an absolute value, if you have a negative number, this will make it positive.
([sqrt v] of (9)::operators)
This is to square root the number, so the square root of 9 is 3.
([sin v] of (9)::operators)
This is just trigonometry
- TheCreatorOfUnTV
-
Scratcher
1000+ posts
How to use sin, cos, abs, etc? I need help
I already know how to use it, I don't need anything else /:Press the close topic button to close this topic.
- Discussion Forums
- » Help with Scripts
-
» How to use sin, cos, abs, etc? I need help