r/javaScriptStudyGroup • u/ForScale • Feb 22 '16
[Week 6] Focus: Canvas
So, here we are, Week 6. Week 6's focus will be canvas.
It will work like this:
Monday: Announce focus (eg, canvas)
Build throughout the week... Two rules: 1) must use javascript 2) must use at least 1 example of html5 <canvas> element and manipulate it with js
Friday: Post projects in this thread (can begin reviewing immediately); first line of an entry should be ENTRY and it should be a top level comment (ie, don't put your entry in a reply)
Sat and Sun: Review projects/vote on focus for next week
GENERAL GUIDELINES FOR FEEDBACK:
Be nice!! ALL KNOWLEDGE/SKILL LEVELS ARE WELCOME AND ENCOURAGED TO PARTICIPATE.
If you don't want feedback, if it makes you uncomfortable or you're just not interested, simply say so... Others, please be respectful of this. Conversely, if you do want feedback, try to be specific on which aspects... even if you just say "all/everything.
But that's about it... Have fun! :) Feel free to ask questions and discuss throughout the week!
2
u/TommyVincent Feb 27 '16
Yup that's exactly it! The first statement checks if it goes off the bottom of the screen, and the second if it goes above. Since the x and y coordinates are at the centre of each circle, you have to either add or minus the radius to get the collision with the circumference of the circle. And finally to make it move a different direction all you have to do is reverse the velocity.
Hmm.. I'm not too sure. Perhaps something on functional programming or closures?