This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* クラス間のプロトタイプによる継承関係を定義する。<br> | |
* このメソッドで継承関係が定義されたクラスには、継承元クラスを参照するsuperClassプロパティが追加される。 | |
* @param {Class} subClass 継承先のクラス | |
* @param {Class} [superClass=MeObject] 継承元のクラス | |
* @param {String} [alias] toStringメソッドに表示されるクラス名 | |
*/ | |
MeObject.inherit = function(subClass, superClass, alias) { | |
superClass = superClass || MeObject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* I want to expose in your name to the specified data. | |
* @param {*} Data published | |
* @param {String} alias External publication of name. From the reference scope, I specify a relative name, including the namespace name | |
* @param {Object} [scope=window] Data release position | |
* @return {Boolean} If true, data published | |
*/ | |
MeObject.expose = function(data, alias, scope) { | |
scope = scope || window; | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################################### | |
# - 这里列出所有js文件名 | |
# - 使用#作为注释 | |
# - pre.js、post.jsの順序の変更は不可。 | |
######################################################################################### | |
pre.js | |
NttObject.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Person(name) { | |
this.name = name; | |
}; | |
Person.prototype = new Object({ | |
getName: function() { | |
return this.name; | |
} | |
}); | |
Person.prototype.constructor = Person; // 这里需要使用Person来替换掉Object。 | |
var p = new Person("ZhangSan"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array: | |
splice(array, index, data1 [,data2] ...) 添加删除方法 | |
1)index为0时,不做删除 | |
2)index为负数时,从数组最后开始计算 ?? | |
3)index大于0时,删除并替代之后的对象?? | |
unshift() 方法可向数组的开头添加一个或更多元素,并返回新的长度。 | |
shift() 方法用于把数组的第一个元素从其中删除,并返回第一个元素的值。 | |
object.constructor 返回创建此object的构造函数内容。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply方法能劫持另外一个对象的属性和方法,从而实现继承。 | |
Func.apply(obj, args); | |
obj: 代替Func类里的this对象 | |
args: 数组,作为参数 | |
例如: | |
function Person(name,age) | |
{ | |
this.name=name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toScreenXY( object, camera, div ) { | |
var mat = object.matrixWorld; | |
var pos = new THREE.Vector3(); | |
pos = mat.multiplyVector3(pos); | |
projected = pos.clone(); | |
projScreenMat = new THREE.Matrix4(); | |
projScreenMat.multiply( camera.projectionMatrix, camera.matrixWorldInverse ); | |
projScreenMat.multiplyVector3( projected ); | |
var offset = findOffset(div); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#main { | |
max-width: 600px; | |
margin: 0 auto; | |
} | |
最大宽度600px,并居中。 | |
* { | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1\ 创造一个空间,在这个空间内添加其他物体 | |
// SKYBOX/FOG | |
var skyBoxGeometry = new THREE.CubeGeometry( 10000, 10000, 10000 ); | |
var skyBoxMaterial = new THREE.MeshBasicMaterial( { color: 0x9999ff, side: THREE.BackSide } ); | |
var skyBox = new THREE.Mesh( skyBoxGeometry, skyBoxMaterial ); | |
skyBox.flipSided = true; // render faces from inside of the cube, instead of from outside (default). | |
// scene.add(skyBox); | |
scene.fog = new THREE.FogExp2( 0x9999ff, 0.00025 ); | |
NewerOlder