Discuss Scratch
- KangaCoder
-
1000+ posts
trigonometry on scratch
Trigonometry is a branch of mathematics that studies the relationship between the side lengths and angles of triangles.
Trigonometry (sometimes called trig) uses 3 basic formulas regarding the relationships between sides and angles of right triangles.

While it can seem complicated, trig can be used in Scratch projects to create really cool things like this and this.
Pretty cool huh? Well, using the

blocks, you can create some pretty cool stuff!
Play around with them! What sort of trig stuff can we come up with?
Information sourced from Wikipedia
Thanks to Firedrake969 and bubble103 for their projects
Trigonometry (sometimes called trig) uses 3 basic formulas regarding the relationships between sides and angles of right triangles.

While it can seem complicated, trig can be used in Scratch projects to create really cool things like this and this.
Pretty cool huh? Well, using the

blocks, you can create some pretty cool stuff!
Play around with them! What sort of trig stuff can we come up with?
Information sourced from Wikipedia
Thanks to Firedrake969 and bubble103 for their projects
- PoIygon
-
1000+ posts
trigonometry on scratch
well i already know you can make things go up and down smoothly using it
- KangaCoder
-
1000+ posts
trigonometry on scratch
well i already know you can make things go up and down smoothly using itw a v y

- imfh
-
1000+ posts
trigonometry on scratch
Don't forget the atan function! It is really useful if you want to make a sprite point towards a specific spot without making it point at another sprite.
point towards ((x position) - (mouse x)) ((y position) - (mouse y)) // Note, might be backwards
define point towards (dx) (dy)
point in direction ([atan v] of ((dy) / (dx)))
if <(dy) < [0]> then
turn cw (180) degrees
end
Last edited by imfh (Sept. 28, 2021 15:24:38)
- Vaibhs11
-
1000+ posts
trigonometry on scratch
mMmM yummy trig
I have made tons of junk trig projects, filled wave, circle, filled circle and even used trig for collabs (for smooth movement
)
I have made tons of junk trig projects, filled wave, circle, filled circle and even used trig for collabs (for smooth movement

- Vaibhs11
-
1000+ posts
trigonometry on scratch
mmm s m o o t h and m o i s twell i already know you can make things go up and down smoothly using itw a v y


- han614698
-
1000+ posts
trigonometry on scratch
the most classic thing:
set [temp v] to [0]
forever
change y by ([cos v] of (temp)::operators)
change [temp v] by (6.3)
end
- Vaibhs11
-
1000+ posts
trigonometry on scratch
Yep, but a majority of users use sin. the most classic thing:set [temp v] to [0]
forever
change y by ([cos v] of (temp)::operators)
change [temp v] by (6.3)
end
- han614698
-
1000+ posts
trigonometry on scratch
I prefer cos.Yep, but a majority of users use sin. the most classic thing:set [temp v] to [0]
forever
change y by ([cos v] of (temp)::operators)
change [temp v] by (6.3)
end
- awesome-llama
-
1000+ posts
trigonometry on scratch
I use whichever works. Depends on what you want to do when the input angle is 0. Sin is good if you want the start point to be 0 too.I prefer cos.Yep, but a majority of users use sin. the most classic thing:set [temp v] to [0]
forever
change y by ([cos v] of (temp)::operators)
change [temp v] by (6.3)
end
- Vaibhs11
-
1000+ posts
trigonometry on scratch
Cosine is useful if you want it to be shifted 90° for some reasonI use whichever works. Depends on what you want to do when the input angle is 0. Sin is good if you want the start point to be 0 too.I prefer cos.Yep, but a majority of users use sin. the most classic thing:set [temp v] to [0]
forever
change y by ([cos v] of (temp)::operators)
change [temp v] by (6.3)
end
- Sheep_maker
-
1000+ posts
trigonometry on scratch
Isn't it dy/dx? Don't forget the atan function! It is really useful if you want to make a sprite point towards a specific spot without making it point at another sprite.point towards ((x position) - (mouse x)) ((y position) - (mouse y)) // Note, might be backwards
define point towards (dx) (dy)
point in direction ([atan v] of ((dx) / (dy)))
if <(dy) < [0]> then
turn cw (180) degrees
end
It sometimes throws me off that JavaScript's Math.atan2, which handles adding 180° if necessary, takes y then x, but I guess it makes sense because of this
- imfh
-
1000+ posts
trigonometry on scratch
Whoops, yep, you’re right.Isn't it dy/dx? Don't forget the atan function! It is really useful if you want to make a sprite point towards a specific spot without making it point at another sprite.point towards ((x position) - (mouse x)) ((y position) - (mouse y)) // Note, might be backwards
define point towards (dx) (dy)
point in direction ([atan v] of ((dx) / (dy)))
if <(dy) < [0]> then
turn cw (180) degrees
end
It sometimes throws me off that JavaScript's Math.atan2, which handles adding 180° if necessary, takes y then x, but I guess it makes sense because of this
- Vaibhs11
-
1000+ posts
trigonometry on scratch
Funny triangle and vertex going around a circle and getting its x pos as sin and and y pos as cos Circular movement is cool
Trigonometry itself is cool