Lucas Kent e39465ad2f Changes to be committed:
new file:   Files/flashplayer_32_sa.exe
	new file:   favicon.ico
	new file:   globe.gif
	new file:   imgs/download.png
	new file:   imgs/zuck.jpg
	new file:   index.html
	new file:   other.ico
	new file:   script.js
	new file:   site.webmanifest
	new file:   sitemap.html
	new file:   styles/backround.css
	new file:   styles/border.css
	new file:   styles/fonts/Titillium_Web/OFL.txt
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-Black.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-Bold.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-BoldItalic.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-ExtraLight.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-ExtraLightItalic.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-Italic.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-Light.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-LightItalic.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-Regular.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-SemiBold.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-SemiBoldItalic.ttf
	new file:   styles/fonts/webfontkit-20221027-163353/generator_config.txt
	new file:   styles/fonts/webfontkit-20221027-163353/specimen_files/grid_12-825-55-15.css
	new file:   styles/fonts/webfontkit-20221027-163353/specimen_files/specimen_stylesheet.css
	new file:   styles/fonts/webfontkit-20221027-163353/stylesheet.css
	new file:   styles/fonts/webfontkit-20221027-163353/titilliumweb-extralight-demo.html
	new file:   styles/fonts/webfontkit-20221027-163353/titilliumweb-extralight-webfont.woff
	new file:   styles/fonts/webfontkit-20221027-163353/titilliumweb-extralight-webfont.woff2
	new file:   styles/fonts/webfontkit-20221027-165950/generator_config.txt
	new file:   styles/fonts/webfontkit-20221027-165950/specimen_files/grid_12-825-55-15.css
	new file:   styles/fonts/webfontkit-20221027-165950/specimen_files/specimen_stylesheet.css
	new file:   styles/fonts/webfontkit-20221027-165950/stylesheet.css
	new file:   styles/fonts/webfontkit-20221027-165950/titilliumweb-bold-demo.html
	new file:   styles/fonts/webfontkit-20221027-165950/titilliumweb-bold-webfont.woff
	new file:   styles/fonts/webfontkit-20221027-165950/titilliumweb-bold-webfont.woff2
	new file:   styles/style.css
	new file:   tools/2048/.gitignore
	new file:   tools/2048/.jshintrc
	new file:   tools/2048/CONTRIBUTING.md
	new file:   tools/2048/LICENSE.txt
	new file:   tools/2048/README.md
	new file:   tools/2048/Rakefile
	new file:   tools/2048/favicon.ico
	new file:   tools/2048/index.html
	new file:   tools/2048/js/animframe_polyfill.js
	new file:   tools/2048/js/application.js
	new file:   tools/2048/js/bind_polyfill.js
	new file:   tools/2048/js/classlist_polyfill.js
	new file:   tools/2048/js/game_manager.js
	new file:   tools/2048/js/grid.js
	new file:   tools/2048/js/html_actuator.js
	new file:   tools/2048/js/keyboard_input_manager.js
	new file:   tools/2048/js/local_storage_manager.js
	new file:   tools/2048/js/tile.js
    new file:   tools/2048/meta/apple-touch-icon.png
	new file:   tools/webretro/cores/neocd_libretro.js
	new file:   tools/webretro/cores/neocd_libretro.wasm
	new file:   tools/webretro/cores/nestopia_libretro.js
	new file:   tools/webretro/cores/nestopia_libretro.wasm
	new file:   tools/webretro/cores/o2em_libretro.js
	new file:   tools/webretro/cores/o2em_libretro.wasm
	new file:   tools/webretro/cores/opera_libretro.js
	new file:   tools/webretro/cores/opera_libretro.wasm
2022-11-02 08:40:01 -04:00

151 lines
3.5 KiB
JavaScript

/*!
* @class bkcore.threejs.Preloader
*
* Displays a small 3D preloader scene
*
* @author Thibaut 'BKcore' Despoulain <http://bkcore.com>
*/
/*!
* @package bkcore.threejs
*/
var bkcore = bkcore || {};
bkcore.threejs = bkcore.threejs || {};
/**
* Creates a new preloader scene.
* You have to update Preloader.ratio with the % loaded info (float 0.0-1.0)
* @param {Object{width, height, scale, line}} opts
*/
bkcore.threejs.Preloader = function(opts)
{
this.document = opts.document || document;
this.end = false;
this.time = 0.0;
this.y = 0.3;
this.ratio = 0.0;
this.height = opts.height;
this.width = opts.width;
this.scale = opts.scale == undefined ? 10 : opts.scale
this.line = opts.line == undefined ? 3 : opts.line;
this.container = opts.container;
this.renderer = new THREE.CanvasRenderer({
clearColor: 0xffffff
});
this.renderer.setSize( opts.width, opts.height );
this.container.appendChild( this.renderer.domElement );
this.ctx = this.renderer.domElement.getContext('2d');
this.ctx.textAlign = "center";
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera( 70, opts.width / opts.height, 1, 1000 );
this.camera.position.z = 100;
this.scene.add( this.camera );
this.stage = new THREE.Object3D();
this.stage.position.set(0,10,0);
this.scene.add(this.stage);
this.cube = new THREE.Mesh( new THREE.CubeGeometry( this.scale, this.scale, this.scale, 1, 1, 1 ),
new THREE.MeshBasicMaterial( { color: 0x999999 } ) );
this.cube.scale.set(0.0,0.0,0.0);
this.stage.add(this.cube);
this.cubew = new THREE.Mesh( new THREE.CubeGeometry( this.scale, this.scale, this.scale, 1, 1, 1 ),
new THREE.MeshBasicMaterial( {
wireframe: true,
wireframeLinewidth: this.line,
//wireframeLinecap: 'square',
//wireframeLinejoin: 'square',
color: 0xffffff
} ) );
this.cube.add(this.cubew);
this.outercube = new THREE.Mesh( new THREE.CubeGeometry( this.scale, this.scale, this.scale, 1, 1, 1 ),
new THREE.MeshBasicMaterial( {
wireframe: true,
wireframeLinewidth: this.line,
//wireframeLinecap: 'square',
//wireframeLinejoin: 'square',
color: 0x0093d8
} ) );
this.stage.add(this.outercube);
var self = this;
function raf()
{
if(!self.end)
{
requestAnimationFrame( raf );
self.render();
}
}
raf();
function mm(e){
self.mouseMove.call(self, e);
}
this.mmsave = mm;
this.document.addEventListener( 'mousemove', mm, false );
}
/**
* Render method to be called from a RAF loop
*/
bkcore.threejs.Preloader.prototype.render = function()
{
this.time += 0.02;
this.ctx.clearRect(0 , 0 , this.width , this.height);
var s = (this.ratio - this.cube.scale.x) * 0.3;
this.cube.scale.addScalar(s);
this.cube.rotation.y = this.time;
this.outercube.rotation.y = this.time;
this.stage.rotation.x += (this.y - this.stage.rotation.x)*0.3;
this.renderer.render( this.scene, this.camera );
this.ctx.save();
this.ctx.font = "40px Arial";
this.ctx.fillStyle = "rgb(200, 200, 200)";
this.ctx.fillText(Math.round(this.ratio*100), this.width/2, this.height/2+30);
this.ctx.restore();
}
bkcore.threejs.Preloader.prototype.mouseMove = function(event)
{
var h2 = this.height/2;
this.y = -(event.clientY - h2)/h2+0.3;
}
/**
* Deletes the Preloader
*/
bkcore.threejs.Preloader.prototype.remove = function()
{
this.document.removeEventListener( 'mousemove', this.mm, false );
this.end = true;
this.renderer = null;
this.scene = null;
this.stage = null;
this.cube = null;
this.cubew = null;
this.innercube = null;
this.container.innerHTML = "";
}