I alsohaveallthedifferentscripttagsandJavascriptthatweneedfor a projectalreadydownloaded.
Sothemainthingswe'regoingtoneedHTMLtocanvas, whichwillallowustoconvertanHTMLelementto a canvaselementprettyselfexplanatoryandthendisintegratedotJs, whichwillallowustotake a canvasselementandbreakitapartinto a bunchofsmallpieces, whichgivesyouthedisintegrationeffect.
I alsohave a stylesheethereand a scripttaglinkedtosowecanwriteourcustom, JavaScriptandourcustoms.
So, whatwewanttodoaswewannatargetthatoriginalimageandwejustwanttosaywelivegroupsjustfromifandnowifwesaythatandclickuse, thatimagedisappearsandwegettheniceparticleeffect.
Butasyoucouldsee, I refreshherethisparticleeffectisnotatallwhatBanosiseffectlookslike.
Thisisgoingtoallowustostartdrawingourrectanglesthatwe'regoingtocreateonourscreen, andthenwewanttousecontextdotPhilRechtandthiswillallowustocreate a rectangle.
Also, wewanttomakethemshrinksowecouldjustsaythisdotsizeisgoingtobetimesequalto 0.95 forexample, andthisjustmeansit's goingtoget a littlebitsmaller 5% everysingletimeandasyousayareparticlesshrinkandmovefasterastheygo.
Andthisisallreallygreat.
Now, thereallyonlylastthingthatwehavelefttodoiswewanttomakeourparticleskindofspawnin a rent a positionwhenwequit, becauserightnowtheyallstayexactlywheretheystarted, andwewantthemtomove a littlebitfromtheinitialstartingplace.
Thisisonlygonnagetrandomonetimeandinsideofhere, whatwewanttodoiswe'regonnatakeourstart X wewantplusequalittomathatrandomthatthoughtrandomisgoingtogiveus a randomvaluebetween 01 As I said, wewanttosubtract 0.5 fromit, andthenwejustwanttomultiplyby 10.
Andthereasonwesubtract 0.5 isthatwhenweget a valuebetweennegative 0.5 andpositive 0.5 soitcanmoveeitherbackwardsorFord.
Andthenwemultipliedby 10 tomakeussoitmovesfurtherthanifwedidn't multipliedbyanythingandwecouldhavetheexactsamesamethinghereforourWhynowIfwesaythatandclick, you'llseeourparticlesactuallyallmoveawayfromtheirinitialstartinglocation, whichgivesit a bitmoreof a randomeffect.