Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add: support for node.js

  • Loading branch information...
commit c4b86df5a571c9730abc4e5c7a131c635e1088a0 1 parent f384dfe
@qiao authored
View
2  demo/index.html
@@ -9,7 +9,7 @@
<script type="text/javascript" src="./lib/Detector.js"></script>
<script type="text/javascript" src="./lib/jquery-1.6.4.min.js"></script>
- <script type="text/javascript" src="../terrain.js"></script>
+ <script type="text/javascript" src="../lib/terrain.js"></script>
<script type="text/javascript" src="./main.js"></script>
</head>
<body>
View
1  index.js
@@ -0,0 +1 @@
+module.exports = require('./lib/terrain.js');
View
4 terrain.js → lib/terrain.js
@@ -18,6 +18,8 @@ var generateTerrain = (function() {
function generateTerrain(width, height, smoothness) {
var max, size, squareTerrain, i, j;
+ smoothness = typeof smoothness === 'undefined' ? 1: smoothness;
+
max = Math.max(width, height);
size = 1;
while (size < max) {
@@ -264,4 +266,4 @@ var generateTerrain = (function() {
if(typeof(exports) !== 'undefined' && exports !== null) {
exports.generateTerrain = generateTerrain;
-}
+}
View
14 package.json
@@ -0,0 +1,14 @@
+{
+ "name" : "fractal-terrain-generator"
+ , "description" : "fractal terrain generator"
+ , "author" : "Xueqiao Xu <xueqiaoxu@gmail.com>"
+ , "homepage" : "https://github.com/qiao/fractal-terrain-generator"
+ , "main" : "./index.js"
+ , "version" : "0.0.1"
+ , "dependencies" : { }
+ , "keywords" : [ "fractal", "terrain", "algorithm" ]
+ , "repository" : {
+ "type" : "git"
+ , "url" : "git@github.com:qiao/fractal-terrain-generator.git"
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.