mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-12-14 01:44:55 +00:00
larry babby and threejs for glsl
This commit is contained in:
21
webGl/my-threejs-test/node_modules/map-limit/LICENSE.md
generated
vendored
Normal file
21
webGl/my-threejs-test/node_modules/map-limit/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
## The MIT License (MIT) ##
|
||||
|
||||
Copyright (c) 2014 Hugh Kennedy
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
32
webGl/my-threejs-test/node_modules/map-limit/README.md
generated
vendored
Normal file
32
webGl/my-threejs-test/node_modules/map-limit/README.md
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
# map-limit [](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/map-limit&title=map-limit&description=hughsk/map-limit%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[](http://github.com/hughsk/stability-badges) #
|
||||
|
||||
[async.mapLimit](https://github.com/caolan/async#maplimitarr-limit-iterator-callback)'s
|
||||
functionality available as a standalone npm module.
|
||||
|
||||
I often find myself pulling in [async](http://github.com/caolan/async) for this
|
||||
method alone, so in the spirit of breaking things into smaller pieces here's
|
||||
that method as a single thing you can require.
|
||||
|
||||
## Usage ##
|
||||
|
||||
[](https://nodei.co/npm/map-limit)
|
||||
|
||||
### `mapLimit(arr, limit, iterator, callback)` ###
|
||||
|
||||
The same as map only no more than "limit" iterators will be simultaneously
|
||||
running at any time.
|
||||
|
||||
Note that the items are not processed in batches, so there is no guarantee
|
||||
that the first "limit" iterator functions will complete before any others are
|
||||
started.
|
||||
|
||||
#### Arguments ####
|
||||
|
||||
* **arr** - An array to iterate over.
|
||||
* **limit** - The maximum number of iterators to run at any time.
|
||||
* **iterator(item, callback)** - A function to apply to each item in the array. The iterator is passed a callback(err, transformed) which must be called once it has completed with an error (which can be null) and a transformed item.
|
||||
* **callback(err, results)** - A callback which is called after all the iterator functions have finished, or an error has occurred. Results is an array of the transformed items from the original array.
|
||||
|
||||
## License ##
|
||||
|
||||
MIT. See [LICENSE.md](http://github.com/hughsk/map-limit/blob/master/LICENSE.md) for details.
|
||||
54
webGl/my-threejs-test/node_modules/map-limit/index.js
generated
vendored
Normal file
54
webGl/my-threejs-test/node_modules/map-limit/index.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
var once = require('once')
|
||||
var noop = function noop(){}
|
||||
|
||||
module.exports = mapLimit
|
||||
|
||||
function mapLimit(arr, limit, iterator, callback) {
|
||||
var complete = 0
|
||||
var aborted = false
|
||||
var results = []
|
||||
var queued = 0
|
||||
var l = arr.length
|
||||
var i = 0
|
||||
|
||||
callback = once(callback || noop)
|
||||
if (typeof iterator !== 'function') throw new Error(
|
||||
'Iterator function must be passed as the third argument'
|
||||
)
|
||||
|
||||
for (var r = 0; r < l; r++) {
|
||||
results[r] = null
|
||||
}
|
||||
|
||||
flush()
|
||||
|
||||
function flush() {
|
||||
if (complete === l)
|
||||
return callback(null, results)
|
||||
|
||||
while (queued < limit) {
|
||||
if (aborted) break
|
||||
if (i === l) break
|
||||
push()
|
||||
}
|
||||
}
|
||||
|
||||
function abort(err) {
|
||||
aborted = true
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
function push() {
|
||||
var idx = i++
|
||||
|
||||
queued += 1
|
||||
|
||||
iterator(arr[idx], function(err, result) {
|
||||
if (err) return abort(err)
|
||||
results[idx] = result
|
||||
complete += 1
|
||||
queued -= 1
|
||||
flush()
|
||||
})
|
||||
}
|
||||
}
|
||||
31
webGl/my-threejs-test/node_modules/map-limit/package.json
generated
vendored
Normal file
31
webGl/my-threejs-test/node_modules/map-limit/package.json
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "map-limit",
|
||||
"description": "async.mapLimit's functionality available as a standalone npm module",
|
||||
"version": "0.0.1",
|
||||
"main": "index.js",
|
||||
"browser": "index.js",
|
||||
"dependencies": {
|
||||
"once": "~1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tape": "~2.4.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test"
|
||||
},
|
||||
"author": "Hugh Kennedy <hughskennedy@gmail.com> (http://hughsk.io/)",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hughsk/map-limit"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/hughsk/map-limit/issues"
|
||||
},
|
||||
"homepage": "https://github.com/hughsk/map-limit",
|
||||
"keywords": [
|
||||
"async",
|
||||
"map",
|
||||
"limit"
|
||||
]
|
||||
}
|
||||
39
webGl/my-threejs-test/node_modules/map-limit/test.js
generated
vendored
Normal file
39
webGl/my-threejs-test/node_modules/map-limit/test.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var test = require('tape')
|
||||
var mapl = require('./')
|
||||
|
||||
test('basic', function(t) {
|
||||
var items = [1, 2, 3, 4, 5]
|
||||
var goals = [2, 4, 6, 8,10]
|
||||
|
||||
t.plan(2)
|
||||
|
||||
mapl(items, 5, function(item, next) {
|
||||
next(null, item * 2)
|
||||
}, function(err, results) {
|
||||
t.ifError(err)
|
||||
t.deepEqual(results, goals)
|
||||
})
|
||||
})
|
||||
|
||||
test('stalled', function(t) {
|
||||
var items = [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
var goals = [2, 4, 6, 8,10,12,14,16]
|
||||
var n = 0
|
||||
|
||||
t.plan(6)
|
||||
|
||||
mapl(items, 2, function(item, next) {
|
||||
setTimeout(function() {
|
||||
n += 1
|
||||
next(null, item * 2)
|
||||
}, 150)
|
||||
}, function(err, results) {
|
||||
t.ifError(err)
|
||||
t.deepEqual(results, goals)
|
||||
})
|
||||
|
||||
setTimeout(function() { t.equal(n, 2) }, 225)
|
||||
setTimeout(function() { t.equal(n, 4) }, 350)
|
||||
setTimeout(function() { t.equal(n, 6) }, 475)
|
||||
setTimeout(function() { t.equal(n, 8) }, 625)
|
||||
})
|
||||
Reference in New Issue
Block a user