This website works better with JavaScript.
Home
Explore
Help
Sign In
sbrl
/
Scene-Starlight
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Activity
Browse Source
Alter all js to use new es6 module syntax
master
Starbeamrainbowlabs
4 years ago
parent
dac909fd12
commit
9f835820dc
4 changed files
with
15 additions
and
1 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+3
-0
Random.js
+4
-0
Star.js
+7
-0
Starlight-Renderer.js
+1
-1
Vector.js
+ 3
- 0
Random.js
View File
@@ -1,3 +1,5 @@
"use strict";
/**
* Bounded random number generator. Has 3 forms:
*
@@ -18,3 +20,4 @@
function random(a,b,c,d)
{d=Math.random();if(typeof a!="number")return d;a=typeof b=="number"?d*(a-b)+b:d*a;a=(typeof b!="number"?b:c)?a:Math.floor(a);return a;}
export default random;
+ 4
- 0
Star.js
View File
@@ -1,5 +1,7 @@
"use strict";
import Vector from './Vector';
class Star
{
constructor(inCanvas, inPosition, inSize)
@@ -28,3 +30,5 @@ class Star
context.restore();
}
}
export default Star;
+ 7
- 0
Starlight-Renderer.js
View File
@@ -1,5 +1,12 @@
"use strict";
import random from './Random'; // Bounded random number generation
import Vector from './Vector'; // 2D vector class
// Subclasses
import Star from './Star';
// ~~~
class StarlightRenderer
{
constructor(canvas)
+ 1
- 1
Vector.js
View File
@@ -215,4 +215,4 @@ class Vector {
}
}
// Make Vector.js Node.js friendly
if (typeof module != "undefined" && module.
export
s)
mo
dul
e.expor
t
s =
Vector;
export d
efa
ult Vector;
Write
Preview
Loading…
Cancel
Save