diff --git a/index.html b/index.html index 243e42e..76b93e6 100644 --- a/index.html +++ b/index.html @@ -69,8 +69,7 @@
-
+{"polys":[{"fillColor":"145-hsb(0.6127364546060563,0.7,1)-hsb(0.8127364546060563,0.9,1)","vertices":[{"x":0.44526315789473686,"y":0.39721627408993576},{"x":0.43473684210526314,"y":0.4336188436830835},{"x":0.4726315789473684,"y":0.4582441113490364},{"x":0.4968421052631579,"y":0.45074946466809424},{"x":0.4968421052631579,"y":0.4068522483940043},{"x":0.48947368421052634,"y":0.3618843683083512},{"x":0.5347368421052632,"y":0.367237687366167},{"x":0.5568421052631579,"y":0.4346895074946467},{"x":0.4905263157894737,"y":0.49785867237687365},{"x":0.4094736842105263,"y":0.480728051391863},{"x":0.39473684210526316,"y":0.42933618843683086}]},{"fillColor":"2-hsb(0.0769373020157218,0.7,1)-hsb(0.2769373020157218,0.9,1)","vertices":[{"x":0.33473684210526317,"y":0.2698072805139186},{"x":0.2326315789473684,"y":0.25910064239828695},{"x":0.20105263157894737,"y":0.2955032119914347},{"x":0.20842105263157895,"y":0.3640256959314775},{"x":0.3021052631578947,"y":0.4004282655246253},{"x":0.28421052631578947,"y":0.3811563169164882},{"x":0.24736842105263157,"y":0.3297644539614561},{"x":0.28210526315789475,"y":0.3094218415417559},{"x":0.3157894736842105,"y":0.31156316916488225}]},{"fillColor":"155-hsb(0.15566174164414406,0.7,1)-hsb(0.3556617416441441,0.9,1)","vertices":[{"x":0.3410526315789474,"y":0.7537473233404711},{"x":0.24210526315789474,"y":0.6156316916488223},{"x":0.2768421052631579,"y":0.5438972162740899},{"x":0.38526315789473686,"y":0.683083511777302},{"x":0.4884210526315789,"y":0.7558886509635975},{"x":0.5431578947368421,"y":0.7505353319057816},{"x":0.6,"y":0.7301927194860813},{"x":0.6484210526315789,"y":0.7751605995717344},{"x":0.6852631578947368,"y":0.7965738758029979},{"x":0.7221052631578947,"y":0.7633832976445396},{"x":0.7273684210526316,"y":0.7130620985010707},{"x":0.7905263157894736,"y":0.765524625267666},{"x":0.716842105263158,"y":0.8340471092077087},{"x":0.5873684210526315,"y":0.8329764453961456},{"x":0.5526315789473685,"y":0.791220556745182},{"x":0.4105263157894737,"y":0.7815845824411135}]},{"fillColor":"48-hsb(0.12024509701877834,0.7,1)-hsb(0.32024509701877835,0.9,1)","vertices":[{"x":0.7263157894736842,"y":0.2366167023554604},{"x":0.6631578947368421,"y":0.27301927194860814},{"x":0.6968421052631579,"y":0.20877944325481798},{"x":0.7,"y":0.16809421841541755},{"x":0.6526315789473685,"y":0.13597430406852248},{"x":0.5852631578947368,"y":0.18950749464668093},{"x":0.5242105263157895,"y":0.1809421841541756},{"x":0.6378947368421053,"y":0.1006423982869379},{"x":0.78,"y":0.13383297644539616}]},{"fillColor":"170-hsb(0.6901865212246776,0.7,1)-hsb(0.8901865212246776,0.9,1)","vertices":[{"x":0.5926315789473684,"y":0.3083511777301927},{"x":0.86,"y":0.4336188436830835},{"x":0.8831578947368421,"y":0.5802997858672377},{"x":0.84,"y":0.6274089935760171},{"x":0.8042105263157895,"y":0.6466809421841542},{"x":0.8231578947368421,"y":0.6809421841541756},{"x":0.8989473684210526,"y":0.6263383297644539},{"x":0.9178947368421052,"y":0.42184154175588867},{"x":0.6094736842105263,"y":0.2890792291220557}]},{"fillColor":"130-hsb(0.7337797865271569,0.7,1)-hsb(0.9337797865271569,0.9,1)","vertices":[{"x":0.631578947368421,"y":0.47644539614561027},{"x":0.5747368421052632,"y":0.40471092077087795},{"x":0.8231578947368421,"y":0.4486081370449679},{"x":0.8378947368421052,"y":0.5032119914346895},{"x":0.7326315789473684,"y":0.5096359743040685}]},{"fillColor":"107-hsb(0.20328011475503446,0.7,1)-hsb(0.40328011475503445,0.9,1)","vertices":[{"x":0.7705263157894737,"y":0.8683083511777302},{"x":0.8368421052631579,"y":0.8436830835117773},{"x":0.8273684210526315,"y":0.784796573875803},{"x":0.8757894736842106,"y":0.7312633832976445},{"x":0.9073684210526316,"y":0.7558886509635975},{"x":0.8989473684210526,"y":0.8854389721627409},{"x":0.8010526315789473,"y":0.9154175588865097}]},{"fillColor":"160-hsb(0.3715801438316703,0.7,1)-hsb(0.5715801438316703,0.9,1)","vertices":[{"x":0.017894736842105262,"y":0.9796573875802997},{"x":0.9757894736842105,"y":0.9817987152034261},{"x":0.9726315789473684,"y":0.05139186295503212},{"x":0.4631578947368421,"y":0.042826552462526764},{"x":0.4105263157894737,"y":0.13062098501070663},{"x":0.38421052631578945,"y":0.11563169164882227},{"x":0.4568421052631579,"y":0.011777301927194861},{"x":0.991578947368421,"y":0.010706638115631691},{"x":0.9947368421052631,"y":0.9935760171306209},{"x":0.004210526315789474,"y":0.9925053533190579},{"x":0.00631578947368421,"y":0.008565310492505354},{"x":0.2505263157894737,"y":0.009635974304068522},{"x":0.3368421052631579,"y":0.11134903640256959},{"x":0.31473684210526315,"y":0.13383297644539616},{"x":0.23157894736842105,"y":0.035331905781584586},{"x":0.02736842105263158,"y":0.056745182012847964}]},{"fillColor":"131-hsb(0.07743788808584214,0.7,1)-hsb(0.27743788808584213,0.9,1)","vertices":[{"x":0.26526315789473687,"y":0.16274089935760172},{"x":0.29473684210526313,"y":0.19700214132762311},{"x":0.32421052631578945,"y":0.20235546038543897},{"x":0.3452631578947368,"y":0.16916488222698073},{"x":0.36105263157894735,"y":0.16595289079229122},{"x":0.37894736842105264,"y":0.1980728051391863},{"x":0.4031578947368421,"y":0.20556745182012848},{"x":0.44,"y":0.16916488222698073},{"x":0.4789473684210526,"y":0.17130620985010706},{"x":0.46421052631578946,"y":0.23019271948608136},{"x":0.28,"y":0.24197002141327623},{"x":0.23894736842105263,"y":0.20556745182012848}]},{"fillColor":"25-hsb(0.30064821504056455,0.7,1)-hsb(0.5006482150405646,0.9,1)","vertices":[{"x":0.44842105263157894,"y":0.13383297644539616},{"x":0.4747368421052632,"y":0.08029978586723768},{"x":0.54,"y":0.09207708779443255},{"x":0.5526315789473685,"y":0.12419700214132762},{"x":0.5242105263157895,"y":0.13276231263383298},{"x":0.4863157894736842,"y":0.11349036402569593}]}],"particles":[]}
diff --git a/levels.txt b/levels.txt index c9c182a..ec1a777 100644 --- a/levels.txt +++ b/levels.txt @@ -2,4 +2,4 @@ good one: -{"polys":[{"fillColor":"136-hsb(0.06393695343285799,0.7,1)-hsb(0.263936953432858,0.9,1)","vertices":[{"x":0.5010526315789474,"y":0.1948608137044968},{"x":0.48210526315789476,"y":0.1841541755888651},{"x":0.4768421052631579,"y":0.1423982869379015},{"x":0.5168421052631579,"y":0.07815845824411134},{"x":0.6273684210526316,"y":0.048179871520342615},{"x":0.8031578947368421,"y":0.0867237687366167},{"x":0.9189473684210526,"y":0.15096359743040685},{"x":0.9368421052631579,"y":0.25910064239828695},{"x":0.9147368421052632,"y":0.3758029978586724},{"x":0.8357894736842105,"y":0.39721627408993576},{"x":0.7810526315789473,"y":0.34796573875803},{"x":0.7978947368421052,"y":0.2880085653104925},{"x":0.8547368421052631,"y":0.28693790149892934},{"x":0.8557894736842105,"y":0.25910064239828695},{"x":0.7926315789473685,"y":0.2644539614561028},{"x":0.7610526315789473,"y":0.34796573875803},{"x":0.8073684210526316,"y":0.4464668094218415},{"x":0.9126315789473685,"y":0.4282655246252677},{"x":0.9652631578947368,"y":0.278372591006424},{"x":0.92,"y":0.06423982869379015},{"x":0.7768421052631579,"y":0.031049250535331904},{"x":0.5231578947368422,"y":0.033190578158458245},{"x":0.48210526315789476,"y":0.06209850107066381},{"x":0.4673684210526316,"y":0.1006423982869379},{"x":0.4652631578947368,"y":0.2012847965738758}]},{"fillColor":"107-hsb(0.7442261235788465,0.7,1)-hsb(0.9442261235788465,0.9,1)","vertices":[{"x":0.3094736842105263,"y":0.7430406852248393},{"x":0.31894736842105265,"y":0.17656765676567654},{"x":0.4515789473684211,"y":0.17656765676567654},{"x":0.4515789473684211,"y":0.12376237623762376},{"x":0.2694736842105263,"y":0.11716171617161716},{"x":0.27789473684210525,"y":0.7904290429042904},{"x":0.7431578947368421,"y":0.8003300330033002},{"x":0.728421052631579,"y":0.1419141914191419},{"x":0.5378947368421053,"y":0.14026402640264027},{"x":0.54,"y":0.24257425742574257},{"x":0.6684210526315789,"y":0.24587458745874588},{"x":0.7094736842105264,"y":0.7569593147751607}]},{"fillColor":"37-hsb(0.5863502260297537,0.7,1)-hsb(0.7863502260297537,0.9,1)","vertices":[{"x":0.4926315789473684,"y":0.20985010706638116},{"x":0.37684210526315787,"y":0.21199143468950749},{"x":0.36,"y":0.6927194860813705},{"x":0.5863157894736842,"y":0.6488222698072805},{"x":0.5936842105263158,"y":0.5867237687366167},{"x":0.4242105263157895,"y":0.639186295503212},{"x":0.40842105263157896,"y":0.5513918629550322},{"x":0.5336842105263158,"y":0.5449678800856531},{"x":0.5210526315789473,"y":0.45610278372591007},{"x":0.5789473684210527,"y":0.45289079229122053},{"x":0.5715789473684211,"y":0.5449678800856531},{"x":0.6178947368421053,"y":0.550321199143469},{"x":0.5915789473684211,"y":0.3993576017130621},{"x":0.5168421052631579,"y":0.4079229122055675},{"x":0.48210526315789476,"y":0.5139186295503212},{"x":0.40210526315789474,"y":0.5096359743040685},{"x":0.4010526315789474,"y":0.36509635974304067},{"x":0.4494736842105263,"y":0.3683083511777302},{"x":0.44842105263157894,"y":0.4421841541755889},{"x":0.4726315789473684,"y":0.44967880085653106},{"x":0.47368421052631576,"y":0.33940042826552463},{"x":0.40842105263157896,"y":0.3297644539614561},{"x":0.41578947368421054,"y":0.2580299785867238},{"x":0.5242105263157895,"y":0.21734475374732334},{"x":0.5189473684210526,"y":0.19914346895074947}]},{"fillColor":"125-hsb(0.32713480163365605,0.7,1)-hsb(0.5271348016336561,0.9,1)","vertices":[{"x":0.5715789473684211,"y":0.3715203426124197},{"x":0.6578947368421053,"y":0.367237687366167},{"x":0.6652631578947369,"y":0.607066381156317},{"x":0.6378947368421053,"y":0.6102783725910065},{"x":0.6273684210526316,"y":0.39186295503211993}]},{"fillColor":"36-hsb(0.7977690029889346,0.7,1)-hsb(0.9977690029889346,0.9,1)","vertices":[{"x":0.47368421052631576,"y":0.29978586723768735},{"x":0.43157894736842106,"y":0.2880085653104925},{"x":0.5042105263157894,"y":0.2462526766595289},{"x":0.5126315789473684,"y":0.27944325481798715}]},{"fillColor":"157-hsb(0.29311543963849546,0.7,1)-hsb(0.49311543963849547,0.9,1)","vertices":[{"x":0.5631578947368421,"y":0.30406852248394006},{"x":0.5378947368421053,"y":0.27944325481798715},{"x":0.6536842105263158,"y":0.2676659528907923},{"x":0.6589473684210526,"y":0.3286937901498929},{"x":0.6147368421052631,"y":0.3351177730192719},{"x":0.6178947368421053,"y":0.2987152034261242},{"x":0.5894736842105263,"y":0.3019271948608137},{"x":0.5473684210526316,"y":0.35867237687366166},{"x":0.5368421052631579,"y":0.32762312633832974}]}],"particles":[]} +{"polys":[{"fillColor":"145-hsb(0.6127364546060563,0.7,1)-hsb(0.8127364546060563,0.9,1)","vertices":[{"x":0.44526315789473686,"y":0.39721627408993576},{"x":0.43473684210526314,"y":0.4336188436830835},{"x":0.4726315789473684,"y":0.4582441113490364},{"x":0.4968421052631579,"y":0.45074946466809424},{"x":0.4968421052631579,"y":0.4068522483940043},{"x":0.48947368421052634,"y":0.3618843683083512},{"x":0.5347368421052632,"y":0.367237687366167},{"x":0.5568421052631579,"y":0.4346895074946467},{"x":0.4905263157894737,"y":0.49785867237687365},{"x":0.4094736842105263,"y":0.480728051391863},{"x":0.39473684210526316,"y":0.42933618843683086}]},{"fillColor":"2-hsb(0.0769373020157218,0.7,1)-hsb(0.2769373020157218,0.9,1)","vertices":[{"x":0.33473684210526317,"y":0.2698072805139186},{"x":0.2326315789473684,"y":0.25910064239828695},{"x":0.20105263157894737,"y":0.2955032119914347},{"x":0.20842105263157895,"y":0.3640256959314775},{"x":0.3021052631578947,"y":0.4004282655246253},{"x":0.28421052631578947,"y":0.3811563169164882},{"x":0.24736842105263157,"y":0.3297644539614561},{"x":0.28210526315789475,"y":0.3094218415417559},{"x":0.3157894736842105,"y":0.31156316916488225}]},{"fillColor":"155-hsb(0.15566174164414406,0.7,1)-hsb(0.3556617416441441,0.9,1)","vertices":[{"x":0.3410526315789474,"y":0.7537473233404711},{"x":0.24210526315789474,"y":0.6156316916488223},{"x":0.2768421052631579,"y":0.5438972162740899},{"x":0.38526315789473686,"y":0.683083511777302},{"x":0.4884210526315789,"y":0.7558886509635975},{"x":0.5431578947368421,"y":0.7505353319057816},{"x":0.6,"y":0.7301927194860813},{"x":0.6484210526315789,"y":0.7751605995717344},{"x":0.6852631578947368,"y":0.7965738758029979},{"x":0.7221052631578947,"y":0.7633832976445396},{"x":0.7273684210526316,"y":0.7130620985010707},{"x":0.7905263157894736,"y":0.765524625267666},{"x":0.716842105263158,"y":0.8340471092077087},{"x":0.5873684210526315,"y":0.8329764453961456},{"x":0.5526315789473685,"y":0.791220556745182},{"x":0.4105263157894737,"y":0.7815845824411135}]},{"fillColor":"48-hsb(0.12024509701877834,0.7,1)-hsb(0.32024509701877835,0.9,1)","vertices":[{"x":0.7263157894736842,"y":0.2366167023554604},{"x":0.6631578947368421,"y":0.27301927194860814},{"x":0.6968421052631579,"y":0.20877944325481798},{"x":0.7,"y":0.16809421841541755},{"x":0.6526315789473685,"y":0.13597430406852248},{"x":0.5852631578947368,"y":0.18950749464668093},{"x":0.5242105263157895,"y":0.1809421841541756},{"x":0.6378947368421053,"y":0.1006423982869379},{"x":0.78,"y":0.13383297644539616}]},{"fillColor":"170-hsb(0.6901865212246776,0.7,1)-hsb(0.8901865212246776,0.9,1)","vertices":[{"x":0.5926315789473684,"y":0.3083511777301927},{"x":0.86,"y":0.4336188436830835},{"x":0.8831578947368421,"y":0.5802997858672377},{"x":0.84,"y":0.6274089935760171},{"x":0.8042105263157895,"y":0.6466809421841542},{"x":0.8231578947368421,"y":0.6809421841541756},{"x":0.8989473684210526,"y":0.6263383297644539},{"x":0.9178947368421052,"y":0.42184154175588867},{"x":0.6094736842105263,"y":0.2890792291220557}]},{"fillColor":"130-hsb(0.7337797865271569,0.7,1)-hsb(0.9337797865271569,0.9,1)","vertices":[{"x":0.631578947368421,"y":0.47644539614561027},{"x":0.5747368421052632,"y":0.40471092077087795},{"x":0.8231578947368421,"y":0.4486081370449679},{"x":0.8378947368421052,"y":0.5032119914346895},{"x":0.7326315789473684,"y":0.5096359743040685}]},{"fillColor":"107-hsb(0.20328011475503446,0.7,1)-hsb(0.40328011475503445,0.9,1)","vertices":[{"x":0.7705263157894737,"y":0.8683083511777302},{"x":0.8368421052631579,"y":0.8436830835117773},{"x":0.8273684210526315,"y":0.784796573875803},{"x":0.8757894736842106,"y":0.7312633832976445},{"x":0.9073684210526316,"y":0.7558886509635975},{"x":0.8989473684210526,"y":0.8854389721627409},{"x":0.8010526315789473,"y":0.9154175588865097}]},{"fillColor":"160-hsb(0.3715801438316703,0.7,1)-hsb(0.5715801438316703,0.9,1)","vertices":[{"x":0.017894736842105262,"y":0.9796573875802997},{"x":0.9757894736842105,"y":0.9817987152034261},{"x":0.9726315789473684,"y":0.05139186295503212},{"x":0.4631578947368421,"y":0.042826552462526764},{"x":0.4105263157894737,"y":0.13062098501070663},{"x":0.38421052631578945,"y":0.11563169164882227},{"x":0.4568421052631579,"y":0.011777301927194861},{"x":0.991578947368421,"y":0.010706638115631691},{"x":0.9947368421052631,"y":0.9935760171306209},{"x":0.004210526315789474,"y":0.9925053533190579},{"x":0.00631578947368421,"y":0.008565310492505354},{"x":0.2505263157894737,"y":0.009635974304068522},{"x":0.3368421052631579,"y":0.11134903640256959},{"x":0.31473684210526315,"y":0.13383297644539616},{"x":0.23157894736842105,"y":0.035331905781584586},{"x":0.02736842105263158,"y":0.056745182012847964}]},{"fillColor":"131-hsb(0.07743788808584214,0.7,1)-hsb(0.27743788808584213,0.9,1)","vertices":[{"x":0.26526315789473687,"y":0.16274089935760172},{"x":0.29473684210526313,"y":0.19700214132762311},{"x":0.32421052631578945,"y":0.20235546038543897},{"x":0.3452631578947368,"y":0.16916488222698073},{"x":0.36105263157894735,"y":0.16595289079229122},{"x":0.37894736842105264,"y":0.1980728051391863},{"x":0.4031578947368421,"y":0.20556745182012848},{"x":0.44,"y":0.16916488222698073},{"x":0.4789473684210526,"y":0.17130620985010706},{"x":0.46421052631578946,"y":0.23019271948608136},{"x":0.28,"y":0.24197002141327623},{"x":0.23894736842105263,"y":0.20556745182012848}]},{"fillColor":"25-hsb(0.30064821504056455,0.7,1)-hsb(0.5006482150405646,0.9,1)","vertices":[{"x":0.44842105263157894,"y":0.13383297644539616},{"x":0.4747368421052632,"y":0.08029978586723768},{"x":0.54,"y":0.09207708779443255},{"x":0.5526315789473685,"y":0.12419700214132762},{"x":0.5242105263157895,"y":0.13276231263383298},{"x":0.4863157894736842,"y":0.11349036402569593}]}],"particles":[]} \ No newline at end of file diff --git a/liquidGraph.js b/liquidGraph.js index acd3284..c1f6e16 100644 --- a/liquidGraph.js +++ b/liquidGraph.js @@ -2131,7 +2131,7 @@ function ConcaveVertexSampler(concaveVertex,fieldAccel) { this.connectedNodeNames = []; this.nameToObject = {}; - this.transitionSpeed = 5.5; //0.5 seconds to transition for the max case + this.transitionSpeed = 25.5; //0.5 seconds to transition for the max case } ConcaveVertexSampler.prototype.sampleConnectivity = function() { diff --git a/liquidGraphAI.js b/liquidGraphAI.js index 2196306..ee63498 100644 --- a/liquidGraphAI.js +++ b/liquidGraphAI.js @@ -244,12 +244,13 @@ GraphSearcher.prototype.buildSolutionAnimation = function() { this.animateStepFunctions = []; - //first, pop on a function that takes in the global accel and rotates to the starting accel - - var _this = this; var initialAccel = globalAccel; var lastG = globalAccel; + //first draw our circle + var firstV = this.solution.nodes[0].cvs.concaveVertex; + this.pBody = cuteSmallCircle(firstV.x,firstV.y); + //now loop through nodes for(var i = 0; i < this.solution.nodes.length -1; i++) { @@ -258,13 +259,14 @@ GraphSearcher.prototype.buildSolutionAnimation = function() { var destNode = this.solution.nodes[i+1]; var name = destNode.locationName; var animation = sourceNode.cvs.animationInfo[name]; + var transPos = sourceNode.cvs.concaveVertex; var startingG = animation.startG; var realEndG = animation.realEndAccel; var transParticle = animation.transParticle; var timeToTransition = animation.timeToTransition; - var gravTransition = this.makeGravityClosure(lastG,startingG,15); + var gravTransition = this.makeGravityClosure(transPos,lastG,startingG,15); //ok so to animate a solution, first transition between these gravity directions this.animateStepFunctions.push(gravTransition); @@ -273,7 +275,6 @@ GraphSearcher.prototype.buildSolutionAnimation = function() { var gravParticleTransition = this.makeGravityParticleTransitionClosure(startingG,realEndG, transParticle,timeToTransition); this.animateStepFunctions.push(gravParticleTransition); - console.log("adding this gravpartilce transition function with",startingG,realEndG,transParticle,timeToTransition); lastG = realEndG; @@ -283,7 +284,7 @@ GraphSearcher.prototype.buildSolutionAnimation = function() { } //push one to return to our original position - gravTransition = this.makeGravityClosure(lastG,initialAccel,15); + gravTransition = this.makeGravityClosure(null,lastG,initialAccel,15); this.animateStepFunctions.push(gravTransition); }; @@ -315,24 +316,38 @@ GraphSearcher.prototype.animateStep = function() { GraphSearcher.prototype.makeGravityParticleTransitionClosure = function(startingG,realEndG,transParticle,timeToTransition) { var _this = this; var gravParticleTransition = function() { - _this.gravityAnimation(startingG,realEndG,timeToTransition); + _this.pBody.hide(); + _this.gravityAnimation(null,startingG,realEndG,timeToTransition); transParticle.animate(); }; return gravParticleTransition; }; -GraphSearcher.prototype.makeGravityClosure = function(startG,endG,time) { +GraphSearcher.prototype.makeGravityClosure = function(transPos,startG,endG,time) { var _this = this; var gravTransition = function() { - _this.gravityAnimation(startG,endG,time); + _this.gravityAnimation(transPos,startG,endG,time); }; return gravTransition; }; -GraphSearcher.prototype.gravityAnimation = function(gStart,gEnd,time) { +GraphSearcher.prototype.gravityAnimation = function(transitionPos,gStart,gEnd,time) { + //update our particleBody to be where the particle sits during transition, if its not a + //particleGravityTransition + if(transitionPos) + { + this.pBody.attr({ + cx:transitionPos.x, + cy:transitionPos.y + }); + this.pBody.show(); + } + var _this = this; var doneFunction = function() { + //hide the pbody + _this.pBody.hide(); _this.animateStep(); };