If you are working with the canvas in any lang, feel free to share some algorithms you know NAME DESCRIP ALGO Never tried the canvas, try it ! vanillajs processingjs p5js if you wish
7/30/2017 4:50:18 PM
Abdur-Rahmaan Janhangeer8 Answers
New AnswerSPIRAL ..draw an spiral .. same as circular motion with the exception of an increasing scalar
BOUNCE ..make an object bounce off a rectangular box .. basic structure: update check edges display .. vars : x y xspeed yspeed .. add speed to position if x>width or x<0 xspeed = xspeed *-1 if y>height or y<0 yspeed = yspeed *-1 .. you can limit velocity if you wish you can include acceleration you can use a custom vector if you wish
I was just trying something and this was the result https://code.sololearn.com/W5ES5DxA1tT0/?ref=app
CIRCULAR MOTION ..make an object move in circle .. x-coord : offset+sin(increasing angle)*scalar y-coord : offset+cos(increasing angle)*scalar vice-versa also works
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message