Skip to content

Instantly share code, notes, and snippets.

@nsfmc
Last active October 1, 2018 10:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsfmc/fc241d6f97a4b3b5203d to your computer and use it in GitHub Desktop.
Save nsfmc/fc241d6f97a4b3b5203d to your computer and use it in GitHub Desktop.
slope fields

a simulation of darts along a slope field

<!doctype html>
<html>
<head>
<style type="text/css">
.dart {
display: inline-block;
width: 13px;
height: 14px;
background-image: url(./dart.png);
background-size: contain;
background-repeat: no-repeat;
margin: 3px;
-webkit-animation:spin 8s linear infinite;
-moz-animation:spin 8s linear infinite;
animation:spin 8s linear infinite;
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
</style>
</head>
<body>
<div id="content-here"></div>
<script src="https://fb.me/react-0.13.1.js"></script>
<script src="https://fb.me/JSXTransformer-0.13.1.js"></script>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/jsx">
var arr = [[0.0, 0.033157279810811534, 0.06631455962162307, 0.0994718394324346, 0.13262911924324614, 0.16578639905405765, 0.1989436788648692, 0.2321009586756807, 0.26525823848649227, 0.2984155182973038, 0.3315727981081153, 0.3647300779189268, 0.3978873577297384, 0.4310446375405499, 0.4642019173513614, 0.4973591971621729, 0.5305164769729845, 0.5636737567837959, 0.5968310365946076, 0.6299883164054191, 0.6631455962162306, 0.6963028760270421, 0.7294601558378536, 0.7626174356486652, 0.7957747154594768, 0.8289319952702882, 0.8620892750810998, 0.8952465548919113, 0.9284038347027228, 0.9615611145135344], [0.033157279810811534, 0.06631455962162307, 0.0994718394324346, 0.13262911924324614, 0.16578639905405765, 0.1989436788648692, 0.2321009586756807, 0.2652582384864922, 0.2984155182973038, 0.3315727981081153, 0.36473007791892686, 0.3978873577297384, 0.4310446375405499, 0.46420191735136146, 0.4973591971621729, 0.5305164769729845, 0.563673756783796, 0.5968310365946076, 0.6299883164054191, 0.6631455962162306, 0.6963028760270421, 0.7294601558378536, 0.7626174356486651, 0.7957747154594768, 0.8289319952702882, 0.8620892750810997, 0.8952465548919113, 0.9284038347027228, 0.9615611145135342, 0.9947183943243458], [0.06631455962162307, 0.0994718394324346, 0.13262911924324614, 0.16578639905405765, 0.1989436788648692, 0.23210095867568073, 0.26525823848649227, 0.2984155182973038, 0.3315727981081153, 0.3647300779189268, 0.3978873577297384, 0.43104463754054984, 0.4642019173513614, 0.4973591971621729, 0.5305164769729844, 0.5636737567837959, 0.5968310365946076, 0.629988316405419, 0.6631455962162306, 0.6963028760270421, 0.7294601558378537, 0.7626174356486652, 0.7957747154594768, 0.8289319952702884, 0.8620892750810998, 0.8952465548919113, 0.9284038347027229, 0.9615611145135344, 0.9947183943243458, 0.02787567413515751], [0.0994718394324346, 0.13262911924324614, 0.16578639905405765, 0.1989436788648692, 0.23210095867568073, 0.26525823848649227, 0.2984155182973038, 0.33157279810811524, 0.36473007791892686, 0.3978873577297384, 0.4310446375405499, 0.4642019173513614, 0.4973591971621729, 0.5305164769729845, 0.5636737567837959, 0.5968310365946076, 0.6299883164054191, 0.6631455962162305, 0.6963028760270421, 0.7294601558378537, 0.7626174356486652, 0.7957747154594768, 0.8289319952702882, 0.8620892750810998, 0.8952465548919113, 0.9284038347027228, 0.9615611145135344, 0.9947183943243458, 0.02787567413515737, 0.06103295394596899], [0.13262911924324614, 0.16578639905405765, 0.1989436788648692, 0.23210095867568073, 0.26525823848649227, 0.2984155182973038, 0.3315727981081153, 0.3647300779189268, 0.3978873577297384, 0.4310446375405499, 0.46420191735136146, 0.4973591971621729, 0.5305164769729845, 0.563673756783796, 0.5968310365946076, 0.6299883164054191, 0.6631455962162306, 0.6963028760270421, 0.7294601558378536, 0.7626174356486652, 0.7957747154594768, 0.8289319952702882, 0.8620892750810997, 0.8952465548919113, 0.9284038347027228, 0.9615611145135342, 0.9947183943243458, 0.02787567413515737, 0.06103295394596885, 0.09419023375678047], [0.16578639905405765, 0.1989436788648692, 0.23210095867568073, 0.26525823848649227, 0.2984155182973038, 0.3315727981081153, 0.36473007791892686, 0.3978873577297384, 0.4310446375405499, 0.46420191735136146, 0.4973591971621729, 0.5305164769729844, 0.563673756783796, 0.5968310365946076, 0.629988316405419, 0.6631455962162306, 0.6963028760270421, 0.7294601558378536, 0.7626174356486652, 0.7957747154594768, 0.8289319952702884, 0.8620892750810998, 0.8952465548919113, 0.9284038347027229, 0.9615611145135344, 0.9947183943243458, 0.02787567413515751, 0.06103295394596899, 0.09419023375678047, 0.1273475135675921], [0.1989436788648692, 0.2321009586756807, 0.26525823848649227, 0.2984155182973038, 0.3315727981081153, 0.36473007791892686, 0.3978873577297384, 0.43104463754054984, 0.46420191735136146, 0.4973591971621729, 0.5305164769729845, 0.5636737567837959, 0.5968310365946076, 0.6299883164054191, 0.6631455962162305, 0.6963028760270421, 0.7294601558378537, 0.7626174356486651, 0.7957747154594768, 0.8289319952702884, 0.8620892750810998, 0.8952465548919113, 0.9284038347027228, 0.9615611145135344, 0.9947183943243458, 0.02787567413515737, 0.06103295394596899, 0.09419023375678047, 0.12734751356759197, 0.1605047933784036], [0.2321009586756807, 0.2652582384864922, 0.2984155182973038, 0.33157279810811524, 0.3647300779189268, 0.3978873577297384, 0.43104463754054984, 0.4642019173513614, 0.4973591971621729, 0.5305164769729844, 0.563673756783796, 0.5968310365946076, 0.629988316405419, 0.6631455962162306, 0.6963028760270421, 0.7294601558378536, 0.7626174356486652, 0.7957747154594768, 0.8289319952702882, 0.8620892750810998, 0.8952465548919113, 0.9284038347027228, 0.9615611145135342, 0.9947183943243458, 0.02787567413515737, 0.06103295394596885, 0.09419023375678047, 0.12734751356759197, 0.16050479337840345, 0.19366207318921508], [0.26525823848649227, 0.2984155182973038, 0.3315727981081153, 0.36473007791892686, 0.3978873577297384, 0.4310446375405499, 0.46420191735136146, 0.4973591971621729, 0.5305164769729845, 0.563673756783796, 0.5968310365946076, 0.629988316405419, 0.6631455962162306, 0.6963028760270421, 0.7294601558378536, 0.7626174356486652, 0.7957747154594768, 0.8289319952702882, 0.8620892750810998, 0.8952465548919113, 0.9284038347027229, 0.9615611145135344, 0.9947183943243458, 0.02787567413515751, 0.06103295394596899, 0.09419023375678047, 0.1273475135675921, 0.1605047933784036, 0.19366207318921508, 0.2268193530000267], [0.2984155182973038, 0.3315727981081153, 0.3647300779189268, 0.3978873577297384, 0.4310446375405499, 0.46420191735136146, 0.4973591971621729, 0.5305164769729844, 0.563673756783796, 0.5968310365946076, 0.6299883164054191, 0.6631455962162305, 0.6963028760270421, 0.7294601558378537, 0.7626174356486651, 0.7957747154594768, 0.8289319952702884, 0.8620892750810997, 0.8952465548919113, 0.9284038347027229, 0.9615611145135344, 0.9947183943243458, 0.02787567413515737, 0.06103295394596899, 0.09419023375678047, 0.12734751356759197, 0.1605047933784036, 0.19366207318921508, 0.22681935300002654, 0.25997663281083816], [0.3315727981081153, 0.36473007791892686, 0.3978873577297384, 0.4310446375405499, 0.46420191735136146, 0.4973591971621729, 0.5305164769729845, 0.563673756783796, 0.5968310365946076, 0.6299883164054191, 0.6631455962162306, 0.6963028760270421, 0.7294601558378537, 0.7626174356486652, 0.7957747154594768, 0.8289319952702884, 0.8620892750810998, 0.8952465548919113, 0.9284038347027229, 0.9615611145135344, 0.9947183943243458, 0.02787567413515751, 0.06103295394596885, 0.09419023375678047, 0.1273475135675921, 0.16050479337840345, 0.19366207318921508, 0.2268193530000267, 0.25997663281083805, 0.2931339126216497], [0.3647300779189268, 0.3978873577297384, 0.43104463754054984, 0.4642019173513614, 0.4973591971621729, 0.5305164769729844, 0.5636737567837959, 0.5968310365946076, 0.629988316405419, 0.6631455962162305, 0.6963028760270421, 0.7294601558378536, 0.7626174356486651, 0.7957747154594768, 0.8289319952702882, 0.8620892750810997, 0.8952465548919113, 0.9284038347027228, 0.9615611145135342, 0.9947183943243458, 0.02787567413515751, 0.06103295394596885, 0.09419023375678047, 0.1273475135675921, 0.16050479337840345, 0.19366207318921508, 0.2268193530000267, 0.25997663281083805, 0.2931339126216497, 0.3262911924324613], [0.3978873577297384, 0.4310446375405499, 0.4642019173513614, 0.4973591971621729, 0.5305164769729845, 0.563673756783796, 0.5968310365946076, 0.629988316405419, 0.6631455962162306, 0.6963028760270421, 0.7294601558378537, 0.7626174356486651, 0.7957747154594768, 0.8289319952702884, 0.8620892750810997, 0.8952465548919113, 0.9284038347027229, 0.9615611145135342, 0.9947183943243458, 0.02787567413515751, 0.06103295394596899, 0.09419023375678047, 0.12734751356759197, 0.1605047933784036, 0.19366207318921508, 0.22681935300002654, 0.25997663281083816, 0.2931339126216497, 0.326291192432461, 0.3594484722432729], [0.4310446375405499, 0.46420191735136146, 0.4973591971621729, 0.5305164769729845, 0.563673756783796, 0.5968310365946076, 0.6299883164054191, 0.6631455962162306, 0.6963028760270421, 0.7294601558378537, 0.7626174356486652, 0.7957747154594768, 0.8289319952702884, 0.8620892750810998, 0.8952465548919113, 0.9284038347027229, 0.9615611145135344, 0.9947183943243458, 0.02787567413515751, 0.06103295394596899, 0.09419023375678047, 0.1273475135675921, 0.16050479337840345, 0.19366207318921508, 0.2268193530000267, 0.25997663281083805, 0.2931339126216497, 0.3262911924324613, 0.35944847224327264, 0.39260575205408427], [0.4642019173513614, 0.4973591971621729, 0.5305164769729844, 0.5636737567837959, 0.5968310365946076, 0.629988316405419, 0.6631455962162305, 0.6963028760270421, 0.7294601558378536, 0.7626174356486651, 0.7957747154594768, 0.8289319952702882, 0.8620892750810997, 0.8952465548919113, 0.9284038347027228, 0.9615611145135342, 0.9947183943243458, 0.02787567413515737, 0.06103295394596885, 0.09419023375678047, 0.1273475135675921, 0.16050479337840345, 0.19366207318921508, 0.2268193530000267, 0.25997663281083805, 0.2931339126216497, 0.3262911924324613, 0.35944847224327264, 0.39260575205408427, 0.4257630318648959], [0.4973591971621729, 0.5305164769729845, 0.5636737567837959, 0.5968310365946076, 0.6299883164054191, 0.6631455962162306, 0.6963028760270421, 0.7294601558378536, 0.7626174356486652, 0.7957747154594768, 0.8289319952702884, 0.8620892750810997, 0.8952465548919113, 0.9284038347027229, 0.9615611145135342, 0.9947183943243458, 0.02787567413515751, 0.06103295394596885, 0.09419023375678047, 0.1273475135675921, 0.1605047933784036, 0.19366207318921508, 0.22681935300002654, 0.25997663281083816, 0.2931339126216497, 0.326291192432461, 0.3594484722432729, 0.39260575205408427, 0.42576303186489556, 0.4589203116757075], [0.5305164769729845, 0.563673756783796, 0.5968310365946076, 0.6299883164054191, 0.6631455962162306, 0.6963028760270421, 0.7294601558378537, 0.7626174356486652, 0.7957747154594768, 0.8289319952702884, 0.8620892750810998, 0.8952465548919113, 0.9284038347027229, 0.9615611145135344, 0.9947183943243458, 0.02787567413515751, 0.06103295394596899, 0.09419023375678047, 0.1273475135675921, 0.1605047933784036, 0.19366207318921508, 0.2268193530000267, 0.25997663281083805, 0.2931339126216497, 0.3262911924324613, 0.35944847224327264, 0.39260575205408427, 0.4257630318648959, 0.4589203116757072, 0.4920775914865188], [0.5636737567837959, 0.5968310365946076, 0.629988316405419, 0.6631455962162305, 0.6963028760270421, 0.7294601558378536, 0.7626174356486651, 0.7957747154594768, 0.8289319952702882, 0.8620892750810997, 0.8952465548919113, 0.9284038347027228, 0.9615611145135342, 0.9947183943243458, 0.02787567413515737, 0.06103295394596885, 0.09419023375678047, 0.12734751356759197, 0.16050479337840345, 0.19366207318921508, 0.2268193530000267, 0.25997663281083805, 0.2931339126216497, 0.3262911924324613, 0.35944847224327264, 0.39260575205408427, 0.4257630318648959, 0.4589203116757072, 0.4920775914865188, 0.5252348712973305], [0.5968310365946076, 0.6299883164054191, 0.6631455962162306, 0.6963028760270421, 0.7294601558378536, 0.7626174356486652, 0.7957747154594768, 0.8289319952702882, 0.8620892750810998, 0.8952465548919113, 0.9284038347027229, 0.9615611145135342, 0.9947183943243458, 0.02787567413515751, 0.06103295394596885, 0.09419023375678047, 0.1273475135675921, 0.16050479337840345, 0.19366207318921508, 0.2268193530000267, 0.25997663281083816, 0.2931339126216497, 0.326291192432461, 0.3594484722432729, 0.39260575205408427, 0.42576303186489556, 0.4589203116757075, 0.4920775914865188, 0.5252348712973302, 0.5583921511081421], [0.6299883164054191, 0.6631455962162306, 0.6963028760270421, 0.7294601558378537, 0.7626174356486652, 0.7957747154594768, 0.8289319952702884, 0.8620892750810998, 0.8952465548919113, 0.9284038347027229, 0.9615611145135344, 0.9947183943243458, 0.02787567413515751, 0.06103295394596899, 0.09419023375678047, 0.1273475135675921, 0.1605047933784036, 0.19366207318921508, 0.2268193530000267, 0.25997663281083816, 0.2931339126216497, 0.3262911924324613, 0.35944847224327264, 0.39260575205408427, 0.4257630318648959, 0.4589203116757072, 0.4920775914865188, 0.5252348712973305, 0.5583921511081418, 0.5915494309189534]];
// this does something similar, but... weird
// var arr = [[0.0, 0.20833333333333334, 0.4166666666666667, 0.625, 0.8333333333333334, 1.0416666666666667, 1.25, 1.4583333333333333, 1.6666666666666667, 1.875, 2.0833333333333335, 2.2916666666666665, 2.5, 2.7083333333333335, 2.9166666666666665, 3.125, 3.3333333333333335, 3.5416666666666665, 3.75, 3.9583333333333335, 4.166666666666667, 4.375, 4.583333333333333, 4.791666666666667, 5.0, 5.208333333333333, 5.416666666666667, 5.625, 5.833333333333333, 6.041666666666667], [0.20833333333333334, 0.4166666666666667, 0.625, 0.8333333333333334, 1.0416666666666667, 1.25, 1.4583333333333333, 1.6666666666666665, 1.875, 2.0833333333333335, 2.291666666666667, 2.5, 2.7083333333333335, 2.916666666666667, 3.125, 3.3333333333333335, 3.541666666666667, 3.75, 3.9583333333333335, 4.166666666666667, 4.375, 4.583333333333333, 4.791666666666666, 5.0, 5.208333333333333, 5.416666666666666, 5.625, 5.833333333333333, 6.041666666666666, 6.25], [0.4166666666666667, 0.625, 0.8333333333333334, 1.0416666666666667, 1.25, 1.4583333333333335, 1.6666666666666667, 1.875, 2.0833333333333335, 2.2916666666666665, 2.5, 2.708333333333333, 2.9166666666666665, 3.125, 3.333333333333333, 3.5416666666666665, 3.75, 3.958333333333333, 4.166666666666667, 4.375, 4.583333333333334, 4.791666666666667, 5.0, 5.208333333333334, 5.416666666666667, 5.625, 5.833333333333334, 6.041666666666667, 6.25, 6.458333333333334], [0.625, 0.8333333333333334, 1.0416666666666667, 1.25, 1.4583333333333335, 1.6666666666666667, 1.875, 2.083333333333333, 2.291666666666667, 2.5, 2.7083333333333335, 2.9166666666666665, 3.125, 3.3333333333333335, 3.5416666666666665, 3.75, 3.9583333333333335, 4.166666666666666, 4.375, 4.583333333333334, 4.791666666666667, 5.0, 5.208333333333333, 5.416666666666667, 5.625, 5.833333333333333, 6.041666666666667, 6.25, 6.458333333333333, 6.666666666666667], [0.8333333333333334, 1.0416666666666667, 1.25, 1.4583333333333335, 1.6666666666666667, 1.875, 2.0833333333333335, 2.2916666666666665, 2.5, 2.7083333333333335, 2.916666666666667, 3.125, 3.3333333333333335, 3.541666666666667, 3.75, 3.9583333333333335, 4.166666666666667, 4.375, 4.583333333333333, 4.791666666666667, 5.0, 5.208333333333333, 5.416666666666666, 5.625, 5.833333333333333, 6.041666666666666, 6.25, 6.458333333333333, 6.666666666666666, 6.875], [1.0416666666666667, 1.25, 1.4583333333333335, 1.6666666666666667, 1.875, 2.0833333333333335, 2.291666666666667, 2.5, 2.7083333333333335, 2.916666666666667, 3.125, 3.333333333333333, 3.541666666666667, 3.75, 3.958333333333333, 4.166666666666667, 4.375, 4.583333333333333, 4.791666666666667, 5.0, 5.208333333333334, 5.416666666666667, 5.625, 5.833333333333334, 6.041666666666667, 6.25, 6.458333333333334, 6.666666666666667, 6.875, 7.083333333333334], [1.25, 1.4583333333333333, 1.6666666666666667, 1.875, 2.0833333333333335, 2.291666666666667, 2.5, 2.708333333333333, 2.916666666666667, 3.125, 3.3333333333333335, 3.5416666666666665, 3.75, 3.9583333333333335, 4.166666666666666, 4.375, 4.583333333333334, 4.791666666666666, 5.0, 5.208333333333334, 5.416666666666667, 5.625, 5.833333333333333, 6.041666666666667, 6.25, 6.458333333333333, 6.666666666666667, 6.875, 7.083333333333333, 7.291666666666667], [1.4583333333333333, 1.6666666666666665, 1.875, 2.083333333333333, 2.2916666666666665, 2.5, 2.708333333333333, 2.9166666666666665, 3.125, 3.333333333333333, 3.541666666666667, 3.75, 3.958333333333333, 4.166666666666667, 4.375, 4.583333333333333, 4.791666666666667, 5.0, 5.208333333333333, 5.416666666666667, 5.625, 5.833333333333333, 6.041666666666666, 6.25, 6.458333333333333, 6.666666666666666, 6.875, 7.083333333333333, 7.291666666666666, 7.5], [1.6666666666666667, 1.875, 2.0833333333333335, 2.291666666666667, 2.5, 2.7083333333333335, 2.916666666666667, 3.125, 3.3333333333333335, 3.541666666666667, 3.75, 3.958333333333333, 4.166666666666667, 4.375, 4.583333333333333, 4.791666666666667, 5.0, 5.208333333333333, 5.416666666666667, 5.625, 5.833333333333334, 6.041666666666667, 6.25, 6.458333333333334, 6.666666666666667, 6.875, 7.083333333333334, 7.291666666666667, 7.5, 7.708333333333334], [1.875, 2.0833333333333335, 2.2916666666666665, 2.5, 2.7083333333333335, 2.916666666666667, 3.125, 3.333333333333333, 3.541666666666667, 3.75, 3.9583333333333335, 4.166666666666666, 4.375, 4.583333333333334, 4.791666666666666, 5.0, 5.208333333333334, 5.416666666666666, 5.625, 5.833333333333334, 6.041666666666667, 6.25, 6.458333333333333, 6.666666666666667, 6.875, 7.083333333333333, 7.291666666666667, 7.5, 7.708333333333333, 7.916666666666667], [2.0833333333333335, 2.291666666666667, 2.5, 2.7083333333333335, 2.916666666666667, 3.125, 3.3333333333333335, 3.541666666666667, 3.75, 3.9583333333333335, 4.166666666666667, 4.375, 4.583333333333334, 4.791666666666667, 5.0, 5.208333333333334, 5.416666666666667, 5.625, 5.833333333333334, 6.041666666666667, 6.25, 6.458333333333334, 6.666666666666666, 6.875, 7.083333333333334, 7.291666666666666, 7.5, 7.708333333333334, 7.916666666666666, 8.125], [2.2916666666666665, 2.5, 2.708333333333333, 2.9166666666666665, 3.125, 3.333333333333333, 3.5416666666666665, 3.75, 3.958333333333333, 4.166666666666666, 4.375, 4.583333333333333, 4.791666666666666, 5.0, 5.208333333333333, 5.416666666666666, 5.625, 5.833333333333333, 6.041666666666666, 6.25, 6.458333333333334, 6.666666666666666, 6.875, 7.083333333333334, 7.291666666666666, 7.5, 7.708333333333334, 7.916666666666666, 8.125, 8.333333333333334], [2.5, 2.7083333333333335, 2.9166666666666665, 3.125, 3.3333333333333335, 3.541666666666667, 3.75, 3.958333333333333, 4.166666666666667, 4.375, 4.583333333333334, 4.791666666666666, 5.0, 5.208333333333334, 5.416666666666666, 5.625, 5.833333333333334, 6.041666666666666, 6.25, 6.458333333333334, 6.666666666666667, 6.875, 7.083333333333333, 7.291666666666667, 7.5, 7.708333333333333, 7.916666666666667, 8.125, 8.333333333333332, 8.541666666666668], [2.7083333333333335, 2.916666666666667, 3.125, 3.3333333333333335, 3.541666666666667, 3.75, 3.9583333333333335, 4.166666666666667, 4.375, 4.583333333333334, 4.791666666666667, 5.0, 5.208333333333334, 5.416666666666667, 5.625, 5.833333333333334, 6.041666666666667, 6.25, 6.458333333333334, 6.666666666666667, 6.875, 7.083333333333334, 7.291666666666666, 7.5, 7.708333333333334, 7.916666666666666, 8.125, 8.333333333333334, 8.541666666666666, 8.75], [2.9166666666666665, 3.125, 3.333333333333333, 3.5416666666666665, 3.75, 3.958333333333333, 4.166666666666666, 4.375, 4.583333333333333, 4.791666666666666, 5.0, 5.208333333333333, 5.416666666666666, 5.625, 5.833333333333333, 6.041666666666666, 6.25, 6.458333333333333, 6.666666666666666, 6.875, 7.083333333333334, 7.291666666666666, 7.5, 7.708333333333334, 7.916666666666666, 8.125, 8.333333333333334, 8.541666666666666, 8.75, 8.958333333333334], [3.125, 3.3333333333333335, 3.5416666666666665, 3.75, 3.9583333333333335, 4.166666666666667, 4.375, 4.583333333333333, 4.791666666666667, 5.0, 5.208333333333334, 5.416666666666666, 5.625, 5.833333333333334, 6.041666666666666, 6.25, 6.458333333333334, 6.666666666666666, 6.875, 7.083333333333334, 7.291666666666667, 7.5, 7.708333333333333, 7.916666666666667, 8.125, 8.333333333333332, 8.541666666666668, 8.75, 8.958333333333332, 9.166666666666668], [3.3333333333333335, 3.541666666666667, 3.75, 3.9583333333333335, 4.166666666666667, 4.375, 4.583333333333334, 4.791666666666667, 5.0, 5.208333333333334, 5.416666666666667, 5.625, 5.833333333333334, 6.041666666666667, 6.25, 6.458333333333334, 6.666666666666667, 6.875, 7.083333333333334, 7.291666666666667, 7.5, 7.708333333333334, 7.916666666666666, 8.125, 8.333333333333334, 8.541666666666666, 8.75, 8.958333333333334, 9.166666666666666, 9.375], [3.5416666666666665, 3.75, 3.958333333333333, 4.166666666666666, 4.375, 4.583333333333333, 4.791666666666666, 5.0, 5.208333333333333, 5.416666666666666, 5.625, 5.833333333333333, 6.041666666666666, 6.25, 6.458333333333333, 6.666666666666666, 6.875, 7.083333333333333, 7.291666666666666, 7.5, 7.708333333333334, 7.916666666666666, 8.125, 8.333333333333334, 8.541666666666666, 8.75, 8.958333333333334, 9.166666666666666, 9.375, 9.583333333333334], [3.75, 3.9583333333333335, 4.166666666666667, 4.375, 4.583333333333333, 4.791666666666667, 5.0, 5.208333333333333, 5.416666666666667, 5.625, 5.833333333333334, 6.041666666666666, 6.25, 6.458333333333334, 6.666666666666666, 6.875, 7.083333333333334, 7.291666666666666, 7.5, 7.708333333333334, 7.916666666666667, 8.125, 8.333333333333332, 8.541666666666668, 8.75, 8.958333333333332, 9.166666666666668, 9.375, 9.583333333333332, 9.791666666666668], [3.9583333333333335, 4.166666666666667, 4.375, 4.583333333333334, 4.791666666666667, 5.0, 5.208333333333334, 5.416666666666667, 5.625, 5.833333333333334, 6.041666666666667, 6.25, 6.458333333333334, 6.666666666666667, 6.875, 7.083333333333334, 7.291666666666667, 7.5, 7.708333333333334, 7.916666666666667, 8.125, 8.333333333333334, 8.541666666666666, 8.75, 8.958333333333334, 9.166666666666666, 9.375, 9.583333333333334, 9.791666666666666, 10.0]];
var GridBox = React.createClass({
_getStyle: function(el) {
var animationLength = 8000;
return {
// transform: "rotate("+rotation+"deg)"
"-webkit-animation-delay": ~~(el * animationLength) + "ms",
"-moz-animation-delay": ~~(el * animationLength) + "ms",
"-o-animation-delay": ~~(el * animationLength) + "ms",
"animation-delay": ~~(el * animationLength) + "ms",
}
},
render: function(){
var rows = this.props.rots;
var all = []
// rows.map(function(e, i, a))
for(var i=0; i<rows.length; i+=1){
var row = rows[i];
var spans = row.map(function(el, idx, arra){
var rotation = el * 360;
styles = this._getStyle(el);
return (<span className="dart" style={styles} data-rot={el} key={i+"-"+idx}/>)
}.bind(this));
var renderedrow = (<div>
{spans}
</div>);
all.push(renderedrow)
}
return (<div>{all}</div>)
}
});
React.render(<GridBox rots={arr} />, document.getElementById('content-here'));
</script>
</body>
</html>
@nsfmc
Copy link
Author

nsfmc commented Apr 15, 2015

in this specific case, dy/dx = x+y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment