git auto update

This commit is contained in:
lhy6305 2025-04-18 09:42:30 +08:00
commit ff6977c574
15 changed files with 1238 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/*.bat
/*.sh

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
assets/sprite-player.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

14
css/main.css Normal file
View File

@ -0,0 +1,14 @@
*{
margin:0;
padding:0;
outline:none;
position:relative;
left:0;
top:0;
}
body{
width:100vw;
height:100vh;
overflow:hidden;
background-color:#000;
}

9
index.html Normal file
View File

@ -0,0 +1,9 @@
<!DOCTYPE html><html>
<head><meta charset="utf-8">
<link rel="stylesheet" href="./css/main.css">
<script src="./js/0-fconsole.js"></script>
<script src="./js/0-jsloader.js"></script>
<script src="./js/0-jsloadentry.js"></script>
</head><body>
<div id="mainframe"><canvas id="stagecanvas"></canvas></div>
</body></html>

36
js/0-fconsole.js Normal file
View File

@ -0,0 +1,36 @@
//fconsole.js
(function() {
var do_loadfail=function(msg) {
var a=document.createElement("div");
a.style.textAlign="center";
a.style.display="inline-block";
a.style.position="absolute";
a.style.zIndex="999999";
a.style.margin="auto";
a.style.color="rgba("+0xff+","+0xff+","+0x00+",1)";
a.style.width="100%";
a.style.verticalAlign="middle";
a.style.outline="none";
a.style.top="20vh";
a.style.fontSize="20px";
a.style.lineHeight="25px";
a.style.whiteSpace="pre";
a.innerHTML="Fatal error: "+msg;
document.body.innerHTML="";
document.body.style.backgroundColor="rgba("+0x75+","+0x60+","+0x60+",1)";
document.body.appendChild(a);
};
window.loadfail=function(msg) {
if(document.readyState=="complete") {
do_loadfail(msg);
} else {
window.addEventListener("load", function() {
do_loadfail(msg);
});
}
};
})();

19
js/0-jsloadentry.js Normal file
View File

@ -0,0 +1,19 @@
//jsloadentry.js
(async function() {
if(!(typeof scriptManager=="object"&&"loadjs" in scriptManager)) {
if(typeof loadfail=="function") {
loadfail("jsloadentry.jsscriptManager.loadjs is not defined");
} else {
window.alert("jsloadentry.jsscriptManager.loadjs is not defined");
}
return;
}
scriptManager.loadjs("./js/libpolyfill.requestAnimationFrame.js");
scriptManager.loadjs("./js/libutil.js");
scriptManager.loadjs("./js/libcubicbezier.js");
scriptManager.loadjs("./js/libpixi_v891uni.min.js");
scriptManager.loadjs("./js/libtransition.js");
await scriptManager.waitAll();
})();

52
js/0-jsloader.js Normal file
View File

@ -0,0 +1,52 @@
//jsloader.js
(function() {
var scriptManager= {};
scriptManager.loadingcount=0;
scriptManager.loadjs=async function(pth) {
var resolve;
var reject;
var ret=new Promise(function(s, r) {
resolve=s;
reject=r;
});
var sc=document.createElement("script");
sc.src=pth;
//sc.type="text/javascript";
if(document.readyState=="complete") {
document.body.appendChild(sc);
} else {
window.addEventListener("load", function() {
document.body.appendChild(sc);
});
}
sc.addEventListener(("readyState" in sc?"readystatechange":"load"), function() {
console.info("script "+pth+" loaded successfully.");
scriptManager.loadingcount--;
resolve();
});
sc.addEventListener("error", function() {
window.loadfail("script "+pth+" load failed");
reject();
});
scriptManager.loadingcount++;
};
scriptManager.isDone=function() {
return scriptManager.loadingcount==0;
};
scriptManager.waitAll=async function() {
return new Promise(function(resolve, reject) {
});
};
window.scriptManager=scriptManager;
})();

20
js/js2min.bat Normal file
View File

@ -0,0 +1,20 @@
@echo off
if %1 == "" (
exit
)
cmd /c uglifyjs %1 -c -e -o temp.js
cmd /c uglifyjs temp.js -c -e -o %~n1.min%~x1
del /f /s /q temp.js
cmd /c uglifyjs %~n1.min%~x1 -c -e -o temp.js
del /f /s /q %~n1.min%~x1
cmd /c uglifyjs temp.js -c -e -o %~n1.min%~x1
del /f /s /q temp.js
cmd /c uglifyjs %~n1.min%~x1 -c -e -o temp.js
del /f /s /q %~n1.min%~x1
cmd /c uglifyjs temp.js -c -e -o %~n1.min%~x1
del /f /s /q temp.js
cmd /c uglifyjs %~n1.min%~x1 -c -e -o temp.js
del /f /s /q %~n1.min%~x1
cmd /c uglifyjs temp.js -c -e -o %~n1.min%~x1
del /f /s /q temp.js

1
js/libcubicbezier.js Normal file
View File

@ -0,0 +1 @@
!function(){function r(r,n){return 1-3*n+3*r}function n(r,n){return 3*n-6*r}function t(t,u,e){return((r(u,e)*t+n(u,e))*t+3*u)*t}function u(t,u,e){return 3*r(u,e)*t*t+2*n(u,e)*t+3*u}function e(r){return r}function Bezier(r,n,f,i){if(!(0<=r&&r<=1&&0<=f&&f<=1))throw new Error("Bezier x value must be in [0, 1] range");if(r===n&&f===i)return e;for(var a=new(o?Float32Array:Array)(11),c=0;c<11;++c)a[c]=t(.1*c,r,f);return function(e){return 0===e||1===e?e:t(function(n){for(var i,c,e=0,o=1;10!==o&&a[o]<=n;++o)e+=.1;return.001<=(c=u(i=e+(n-a[--o])/(a[o+1]-a[o])*.1,r,f))?function(r,n,e,o){for(var i,f=0;f<4;++f){if(0===(i=u(n,e,o)))return n;n-=(t(n,e,o)-r)/i}return n}(n,i,r,f):0===c?i:function(r,n,u,e,o){for(var f,i,a=0;0<(f=t(i=n+(u-n)/2,e,o)-r)?u=i:n=i,1e-7<Math.abs(f)&&++a<10;);return i}(n,e,e+.1,r,f)}(e),n,i)}}var o="function"==typeof Float32Array;"object"==typeof exports&&"undefined"!=typeof module?module.exports={Bezier:Bezier}:"function"==typeof define&&define.amd?define([],Bezier):("undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window).Bezier=Bezier}();

911
js/libpixi_v891uni.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,30 @@
'use strict';
// requestAnimationFrame polyfill by Erik Möller.
// Fixes from Paul Irish, Tino Zijdel, Andrew Mao, Klemen Slavic, Darius Bacon and Joan Alba Maldonado.
// Adapted from https://gist.github.com/paulirish/1579671 which derived from
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// Added high resolution timing. This window.performance.now() polyfill can be used: https://gist.github.com/jalbam/cc805ac3cfe14004ecdf323159ecf40e
// MIT license
// Gist: https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
(function() {
var vendors = ['webkit', 'moz', 'ms', 'o'], vp = null;
for (var x = 0; x < vendors.length && !window.requestAnimationFrame && !window.cancelAnimationFrame; x++)
{
vp = vendors[x];
window.requestAnimationFrame = window.requestAnimationFrame || window[vp + 'RequestAnimationFrame'];
window.cancelAnimationFrame = window.cancelAnimationFrame || window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame'];
}
if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) //iOS6 is buggy.
{
var lastTime = 0;
window.requestAnimationFrame = function(callback, element)
{
var now = window.performance.now();
var nextTime = Math.max(lastTime + 16, now); //First time will execute it immediately but barely noticeable and performance is gained.
return setTimeout(function() { callback(lastTime = nextTime); }, nextTime - now);
};
window.cancelAnimationFrame = clearTimeout;
}
}());

120
js/libtransition.js Normal file
View File

@ -0,0 +1,120 @@
(function() {
if(typeof libutil!="object") {
if(typeof loadfail=="function") {
loadfail("libtransition.jsobject libutil(type of "+(typeof libutil)+") is not defined");
} else {
window.alert("libtransition.jsobject libutil is not defined");
}
return;
}
if(typeof Bezier!="function") {
if(typeof loadfail=="function") {
loadfail("libtransition.jsclass Bezier(type of "+(typeof Bezier)+") is not defined");
} else {
window.alert("libtransition.jsclass Bezier is not defined");
}
return;
}
if(typeof requestAnimationFrame!="function") {
if(typeof loadfail=="function") {
loadfail("libtransition.jsfunction requestAnimationFrame(type of "+(typeof requestAnimationFrame)+") is not defined");
} else {
window.alert("libtransition.jsfunction requestAnimationFrame is not defined");
}
return;
}
class Transition {
static linear=new Bezier(0, 0, 1, 1);
constructor() {
// static fields (set by user)
this.obj = null;
this.key = null;
this.startval = 0.0;
this.endval = 0.0;
this.duration = 0;
this.animfunc = Transition.linear;
this.stoponend=true;
this.onend = null;
// dynamic fields (set by this program)
this.elapsed = 0;
this.carryover = 0;
}
start() {
this.stop();
transition_update_list.push(this);
}
stop() {
var index=-1;
do {
index = transition_update_list.indexOf(this);
if(index > -1) {
transition_update_list.splice(index, 1);
}
} while(index!=-1);
}
update(et) {
if(window.EnableDebugMode) {
if(!(this.key in this.obj)) {
this.stop();
console.error("the key", this.key, "is not in the obj", this.obj);
return;
}
if(typeof this.animfunc!="function") {
this.stop();
console.error("(a instance of transition).animfunc is not a function");
return;
}
if(!libutil.isNumber(et)) {
et=0;
}
}
// this.carryover is for this.onend() only, not for the animation itself
this.carryover=0;
this.elapsed+=et;
if(this.elapsed>=this.duration) {
this.carryover=this.elapsed-this.duration;
this.elapsed=this.duration;
this.obj[this.key]=this.endval;
if(this.onend!==null&&typeof this.onend=="function") {
try {
this.onend();
} catch(e) {
console.error(e);
}
}
if(this.stoponend) {
this.stop();
}
return;
}
this.obj[this.key]=(this.endval-this.startval)*libutil.clamp(this.animfunc(this.elapsed/this.duration), 0, 1);
}
}
var transition_update_list=[];
var ticker_lasttime=Date.now();
var run_ticker=function(ts) {
requestAnimationFrame(run_ticker);
var et = ts - ticker_lasttime;
ticker_lasttime = ts;
transition_update_list.forEach(function(elem) {
elem.update(et);
});
};
run_ticker(ticker_lasttime);
window.Transition=Transition;
})();

24
js/libutil.js Normal file
View File

@ -0,0 +1,24 @@
(function() {
var libutil= {};
libutil.isNumber=function(v) {
return typeof v === "number";
};
libutil.clamp=function(val, min, max) {
if(window.EnableDebugMode) {
if(max<min) {
console.warn("ibutil.clamp(): the max value is less than the min value");
var min1 = Math.min(min, max);
var max1 = Math.max(min, max);
return Math.min(Math.max(val, min1), max1);
}
}
return Math.min(Math.max(val, min), max);
};
};
window.libutil=libutil;
})();