@next2d/player 2.13.0 → 2.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/next2d.js +2 -2
- package/package.json +14 -13
- package/src/index.js +1 -1
package/next2d.js
CHANGED
|
@@ -135,7 +135,7 @@ precision mediump float;
|
|
|
135
135
|
out vec4 o_color;
|
|
136
136
|
void main() {
|
|
137
137
|
o_color = vec4(1.0);
|
|
138
|
-
}\`,ie=t=>{const e=\`m\${t?"y":"n"}\`;if(Et.has(e))return Et.get(e);const s=new Z(pe(t?9:0,!1,!0,t),Io());return Et.set(e,s),s},ue=(t,e)=>{const s=t.highp;s[0]=e[0],s[1]=e[1],s[2]=0,s[4]=e[2],s[5]=e[3],s[6]=0,s[8]=e[4],s[9]=e[5],s[10]=1,s[12]=e[6],s[13]=e[7],s[14]=0,s[16]=e[8],s[17]=e[9],s[18]=0,s[20]=e[10],s[21]=e[11],s[22]=1,s[3]=it(),s[7]=ut(),s[11]=e[12],s[15]=e[13],s[19]=e[14],s[23]=e[15],s[24]=e[16],s[25]=e[17],s[26]=e[18],s[27]=e[19],s[28]=e[20],s[29]=e[21],s[30]=e[22],s[31]=e[23],s[32]=e[24],s[33]=e[25]};let nc="normal";const oc=t=>{nc=t},rc=()=>nc;let ac=600;const Mt=t=>{ac=t},yt=()=>ac,j=()=>{yt()!==613&&(Mt(613),c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA))},nt=(t,e,s,n)=>{t.useProgram(),t.bindUniform(),j(),$t(e),c.drawArrays(c.TRIANGLES,s,n)},ze=()=>{const t="rmnn";if(Et.has(t))return Et.get(t);const e=new Z(Fo(),Co());return Et.set(t,e),e},Lo=()=>{const t=A.currentAttachmentObject;if(!t)return;const e=1<<t.clipLevel-1;c.stencilMask(~e-1),c.stencilFunc(c.LEQUAL,e,255),c.stencilOp(c.ZERO,c.REPLACE,c.REPLACE),nt(ze(),ge(),0,6),c.stencilMask(1<<t.clipLevel),c.stencilFunc(c.ALWAYS,0,255),c.stencilOp(c.REPLACE,c.REPLACE,c.REPLACE),nt(ze(),ge(),0,6),c.stencilMask(255),c.stencilOp(c.ZERO,c.INVERT,c.INVERT)},ko=()=>{const t=A.currentAttachmentObject;if(!t)return;const e=re.get(t.clipLevel),s=e[0],n=e[1],o=e[2],r=e[3],a=Math.ceil(Math.abs(o-s)),l=Math.ceil(Math.abs(r-n));c.enable(c.SCISSOR_TEST),c.scissor(s,t.height-n-l,a,l);const h=ec();let f=ae.get(t.clipLevel),i=0,E=null;const $=q.length;for(let v=0;v<$;v++){c.stencilMask(1<<f-1);const T=q[v];_t.has(v)&&(E=_t.get(v));const g=ie(!!E);E&&ue(g,E),nt(g,h,i,T),i+=T,++f,f>7&&(Lo(),f=t.clipLevel+1)}ae.set(t.clipLevel,f),sc(h),Hs(),qs(),c.disable(c.SCISSOR_TEST)},No=(t,e,s)=>{if(t.used){const l=t.left?.insert(e,s);return l||t.right?.insert(e,s)||null}
|
|
138
|
+
}\`,ie=t=>{const e=\`m\${t?"y":"n"}\`;if(Et.has(e))return Et.get(e);const s=new Z(pe(t?9:0,!1,!0,t),Io());return Et.set(e,s),s},ue=(t,e)=>{const s=t.highp;s[0]=e[0],s[1]=e[1],s[2]=0,s[4]=e[2],s[5]=e[3],s[6]=0,s[8]=e[4],s[9]=e[5],s[10]=1,s[12]=e[6],s[13]=e[7],s[14]=0,s[16]=e[8],s[17]=e[9],s[18]=0,s[20]=e[10],s[21]=e[11],s[22]=1,s[3]=it(),s[7]=ut(),s[11]=e[12],s[15]=e[13],s[19]=e[14],s[23]=e[15],s[24]=e[16],s[25]=e[17],s[26]=e[18],s[27]=e[19],s[28]=e[20],s[29]=e[21],s[30]=e[22],s[31]=e[23],s[32]=e[24],s[33]=e[25]};let nc="normal";const oc=t=>{nc=t},rc=()=>nc;let ac=600;const Mt=t=>{ac=t},yt=()=>ac,j=()=>{yt()!==613&&(Mt(613),c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA))},nt=(t,e,s,n)=>{t.useProgram(),t.bindUniform(),j(),$t(e),c.drawArrays(c.TRIANGLES,s,n)},ze=()=>{const t="rmnn";if(Et.has(t))return Et.get(t);const e=new Z(Fo(),Co());return Et.set(t,e),e},Lo=()=>{const t=A.currentAttachmentObject;if(!t)return;const e=1<<t.clipLevel-1;c.stencilMask(~e-1),c.stencilFunc(c.LEQUAL,e,255),c.stencilOp(c.ZERO,c.REPLACE,c.REPLACE),nt(ze(),ge(),0,6),c.stencilMask(1<<t.clipLevel),c.stencilFunc(c.ALWAYS,0,255),c.stencilOp(c.REPLACE,c.REPLACE,c.REPLACE),nt(ze(),ge(),0,6),c.stencilMask(255),c.stencilOp(c.ZERO,c.INVERT,c.INVERT)},ko=()=>{const t=A.currentAttachmentObject;if(!t)return;const e=re.get(t.clipLevel),s=e[0],n=e[1],o=e[2],r=e[3],a=Math.ceil(Math.abs(o-s)),l=Math.ceil(Math.abs(r-n));c.enable(c.SCISSOR_TEST),c.scissor(s,t.height-n-l,a,l);const h=ec();let f=ae.get(t.clipLevel),i=0,E=null;const $=q.length;for(let v=0;v<$;v++){c.stencilMask(1<<f-1);const T=q[v];_t.has(v)&&(E=_t.get(v));const g=ie(!!E);E&&ue(g,E),nt(g,h,i,T),i+=T,++f,f>7&&(Lo(),f=t.clipLevel+1)}ae.set(t.clipLevel,f),sc(h),Hs(),qs(),c.disable(c.SCISSOR_TEST)},No=(t,e,s)=>{if(t.used){const l=t.left?.insert(e,s);return l||t.right?.insert(e,s)||null}if(e>t.w||s>t.h)return null;if(e===t.w&&s===t.h)return t.used=!0,t;const n=e+1,o=s+1,r=t.w-n,a=t.h-o;return r>a?(t.left=t.create(t.index,t.x,t.y,e,t.h),t.right=t.create(t.index,t.x+n,t.y,r,t.h)):(t.left=t.create(t.index,t.x,t.y,t.w,s),t.right=t.create(t.index,t.x,t.y+o,t.w,a)),t.used=!0,t.left.insert(e,s)},Po=(t,e,s,n,o)=>t.left?.dispose(e,s,n,o)?(!t.left.used&&!t.right?.used&&(t.left&&t.left.release(),t.right&&t.right.release(),t.left=t.right=null,t.used=!1),!0):t.right?.dispose(e,s,n,o)?(!t.right.used&&!t.left?.used&&(t.left&&t.left.release(),t.right&&t.right.release(),t.left=t.right=null,t.used=!1),!0):e===t.x&&s===t.y&&n===t.w&&o===t.h?(t.used=!1,!0):!1,Ve=[];class We{index;x;y;w;h;left;right;used;constructor(e,s,n,o,r){this.index=e,this.x=s,this.y=n,this.w=o,this.h=r,this.left=null,this.right=null,this.used=!1}insert(e,s){return No(this,e,s)}dispose(e,s,n,o){return Po(this,e,s,n,o)}create(e,s,n,o,r){const a=Ve.length?Ve.pop():new We(e,0,0,0,0);return a.index=e,a.x=s,a.y=n,a.w=o,a.h=r,a.left=null,a.right=null,a.used=!1,a}release(){this.left&&(this.left.release(),this.left=null),this.right&&(this.right.release(),this.right=null),this.used=!1,Ve.push(this)}}class Uo{_$root;constructor(e,s,n){this._$root=new We(e,0,0,s,n)}insert(e,s){return this._$root.insert(e,s)}dispose(e,s,n,o){return this._$root.dispose(e,s,n,o)}}const lc=(t,e)=>{const s=kt();ce[s]||(ce[s]=new Uo(s,rt,rt));const o=ce[s].insert(t,e);return o||(pt(s+1),lc(t,e))},Do=t=>{const e=ce[t.index];e&&e.dispose(t.x,t.y,t.w,t.h)},je=()=>\`
|
|
139
139
|
float isInside(in vec2 uv) {
|
|
140
140
|
return step(4.0, dot(step(vec4(0.0, uv.x, 0.0, uv.y), vec4(uv.x, 1.0, uv.y, 1.0)), vec4(1.0)));
|
|
141
141
|
}\`,ic=t=>\`
|
|
@@ -681,4 +681,4 @@ void main() {
|
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
683
|
</style>
|
|
684
|
-
<div id="${t}"></div>`};let en=-1;const Cl=()=>{window.addEventListener("resize",()=>{cancelAnimationFrame(en),en=requestAnimationFrame(ou)})},vr=(e=null)=>{w.setOptions(e);const t=kl();Ol(t,w.fixedWidth,w.fixedHeight),Fl(t),!w.fixedWidth&&!w.fixedHeight&&Cl(),ou()},Ll=async(e,t=null)=>{if(e==="develop"){const r=location.search.slice(1).split("&")[0];if(!r)return;e=`${location.origin}/${r}`}if(!e)return;e.charAt(1)==="/"&&(e=e.slice(1)),vr(t);const u=new hr,s=u.contentLoaderInfo;if(s.addEventListener(Re.IO_ERROR,r=>{alert("Error: "+r.text)}),await u.load(new yr(e)),!s.data)return;const n=s.data.stage;T.stageWidth=n.width,T.stageHeight=n.height,T.frameRate=Lt(n.fps,1,60,60),T.backgroundColor=t&&t.bgColor?t.bgColor:n.bgColor,T.addChild(s.content),ou(),Ar(),wr(),Mr(),gs()};let tn=!1;const Nl=(e=240,t=240,u=60,s=null)=>{if(tn)return T.getChildAt(0);tn=!0,T.stageWidth=e|0,T.stageHeight=t|0,T.frameRate=Lt(u,1,60,60),vr(s);const n=T.addChild(new cs);return Ar(),wr(),Mr(),gs(),n},Ee={command:"capture",buffer:null,bgColor:16777215,bgAlpha:0,width:0,height:0,length:0,imageBitmaps:null},It=[],it=[],Pl=async(e,t,u,s,n=0,r=0)=>await new Promise(a=>{if(E.offset=0,It.length=0,it.length=0,T.$generateRenderQueue(e,it,t,u),!E.offset)return a(s);Ee.buffer=E.buffer,Ee.width=s.width,Ee.height=s.height,Ee.bgColor=n,Ee.bgAlpha=r,Ee.length=E.offset,It.push(E.buffer.buffer),Ee.imageBitmaps=null,it.length&&(Ee.imageBitmaps=it,It.push(...it));const i=c=>{if(c.data.message!=="capture")return;const o=c.data.buffer;return E.buffer.length<o.length&&(E.buffer=o),s.getContext("2d").drawImage(c.data.imageBitmap,0,0),Me.removeEventListener("message",i),a(s)};Me.addEventListener("message",i),Me.postMessage(Ee,It)}),Ir=async e=>{switch(!0){case e.isVideo:{const t=e.muted;e.muted=!0,await e.play(),e.pause(),e.muted=t,await new Promise(u=>{const s=async()=>{e.loaded?(e.seek(0),u()):requestAnimationFrame(s)};requestAnimationFrame(s)})}break;case e.isContainerEnabled:{const t=e.children;for(let u=0;u<t.length;++u){const s=t[u];s&&(!s.isVideo&&!s.isContainerEnabled||await Ir(s))}}break}},Bl=new Float32Array([1,0,0,1,0,0]),Dl=new Float32Array([1,1,1,1,0,0,0,0]),_l=async(e,t=null)=>{t&&t.videoSync&&await Ir(e);const u=t&&t.colorTransform?t.colorTransform.rawData:Dl,s=new Float32Array([1,0,0,1,-e.width/2,-e.height/2]),n=t&&t.matrix?A.multiply(t.matrix.rawData,s):A.multiply(Bl,s),r=t&&t.canvas?t.canvas:O.getCanvas(),a=Math.sqrt(n[0]*n[0]+n[1]*n[1]),i=Math.sqrt(n[2]*n[2]+n[3]*n[3]),c=Math.ceil(e.width*a),o=Math.ceil(e.height*i);if(c<=0||o<=0)return r;n[4]+=c/2,n[5]+=o/2,r.width=c,r.height=o;const d=w.stopFlag;d||w.stop();let l=!1;const h=w.rendererWidth,b=w.rendererHeight,f=w.rendererScale;if(c>h||o>b){l=!0;const p=Math.min(c/T.stageWidth,o/T.stageHeight)*Ge;T.rendererScale=w.rendererScale=p,T.rendererWidth=w.rendererWidth=c,T.rendererHeight=w.rendererHeight=o,Wu(!1)}return await Pl(e,n,u,r,t&&t.bgColor?parseInt(t.bgColor.replace("#",""),16):0,t&&t.bgAlpha?t.bgAlpha:0),l&&(T.rendererScale=w.rendererScale=f,T.rendererWidth=w.rendererWidth=h,T.rendererHeight=w.rendererHeight=b,Wu(!1)),d||w.play(),A.release(n),t&&t.colorTransform&&C.release(u),r};class Ul{display;events;filters;geom;media;net;text;ui;_$promise;constructor(){this.display=zu,this.events=Hu,this.filters=Gu,this.geom=Ku,this.media=Qu,this.net=Zu,this.text=Ju,this.ui=ju,this._$promise=new Promise(t=>{document.readyState==="loading"?window.addEventListener("DOMContentLoaded",()=>t(),{once:!0}):t()})}async load(t,u=null){await Promise.all([this._$promise]),await Ll(t,u)}async createRootMovieClip(t=240,u=240,s=60,n=null){return await Promise.all([this._$promise]),Nl(t,u,s,n)}async captureToCanvas(t,u=null){return await _l(t,u)}}"next2d"in window||(console.log("%c Next2D Player %c 2.13.
|
|
684
|
+
<div id="${t}"></div>`};let en=-1;const Cl=()=>{window.addEventListener("resize",()=>{cancelAnimationFrame(en),en=requestAnimationFrame(ou)})},vr=(e=null)=>{w.setOptions(e);const t=kl();Ol(t,w.fixedWidth,w.fixedHeight),Fl(t),!w.fixedWidth&&!w.fixedHeight&&Cl(),ou()},Ll=async(e,t=null)=>{if(e==="develop"){const r=location.search.slice(1).split("&")[0];if(!r)return;e=`${location.origin}/${r}`}if(!e)return;e.charAt(1)==="/"&&(e=e.slice(1)),vr(t);const u=new hr,s=u.contentLoaderInfo;if(s.addEventListener(Re.IO_ERROR,r=>{alert("Error: "+r.text)}),await u.load(new yr(e)),!s.data)return;const n=s.data.stage;T.stageWidth=n.width,T.stageHeight=n.height,T.frameRate=Lt(n.fps,1,60,60),T.backgroundColor=t&&t.bgColor?t.bgColor:n.bgColor,T.addChild(s.content),ou(),Ar(),wr(),Mr(),gs()};let tn=!1;const Nl=(e=240,t=240,u=60,s=null)=>{if(tn)return T.getChildAt(0);tn=!0,T.stageWidth=e|0,T.stageHeight=t|0,T.frameRate=Lt(u,1,60,60),vr(s);const n=T.addChild(new cs);return Ar(),wr(),Mr(),gs(),n},Ee={command:"capture",buffer:null,bgColor:16777215,bgAlpha:0,width:0,height:0,length:0,imageBitmaps:null},It=[],it=[],Pl=async(e,t,u,s,n=0,r=0)=>await new Promise(a=>{if(E.offset=0,It.length=0,it.length=0,T.$generateRenderQueue(e,it,t,u),!E.offset)return a(s);Ee.buffer=E.buffer,Ee.width=s.width,Ee.height=s.height,Ee.bgColor=n,Ee.bgAlpha=r,Ee.length=E.offset,It.push(E.buffer.buffer),Ee.imageBitmaps=null,it.length&&(Ee.imageBitmaps=it,It.push(...it));const i=c=>{if(c.data.message!=="capture")return;const o=c.data.buffer;return E.buffer.length<o.length&&(E.buffer=o),s.getContext("2d").drawImage(c.data.imageBitmap,0,0),Me.removeEventListener("message",i),a(s)};Me.addEventListener("message",i),Me.postMessage(Ee,It)}),Ir=async e=>{switch(!0){case e.isVideo:{const t=e.muted;e.muted=!0,await e.play(),e.pause(),e.muted=t,await new Promise(u=>{const s=async()=>{e.loaded?(e.seek(0),u()):requestAnimationFrame(s)};requestAnimationFrame(s)})}break;case e.isContainerEnabled:{const t=e.children;for(let u=0;u<t.length;++u){const s=t[u];s&&(!s.isVideo&&!s.isContainerEnabled||await Ir(s))}}break}},Bl=new Float32Array([1,0,0,1,0,0]),Dl=new Float32Array([1,1,1,1,0,0,0,0]),_l=async(e,t=null)=>{t&&t.videoSync&&await Ir(e);const u=t&&t.colorTransform?t.colorTransform.rawData:Dl,s=new Float32Array([1,0,0,1,-e.width/2,-e.height/2]),n=t&&t.matrix?A.multiply(t.matrix.rawData,s):A.multiply(Bl,s),r=t&&t.canvas?t.canvas:O.getCanvas(),a=Math.sqrt(n[0]*n[0]+n[1]*n[1]),i=Math.sqrt(n[2]*n[2]+n[3]*n[3]),c=Math.ceil(e.width*a),o=Math.ceil(e.height*i);if(c<=0||o<=0)return r;n[4]+=c/2,n[5]+=o/2,r.width=c,r.height=o;const d=w.stopFlag;d||w.stop();let l=!1;const h=w.rendererWidth,b=w.rendererHeight,f=w.rendererScale;if(c>h||o>b){l=!0;const p=Math.min(c/T.stageWidth,o/T.stageHeight)*Ge;T.rendererScale=w.rendererScale=p,T.rendererWidth=w.rendererWidth=c,T.rendererHeight=w.rendererHeight=o,Wu(!1)}return await Pl(e,n,u,r,t&&t.bgColor?parseInt(t.bgColor.replace("#",""),16):0,t&&t.bgAlpha?t.bgAlpha:0),l&&(T.rendererScale=w.rendererScale=f,T.rendererWidth=w.rendererWidth=h,T.rendererHeight=w.rendererHeight=b,Wu(!1)),d||w.play(),A.release(n),t&&t.colorTransform&&C.release(u),r};class Ul{display;events;filters;geom;media;net;text;ui;_$promise;constructor(){this.display=zu,this.events=Hu,this.filters=Gu,this.geom=Ku,this.media=Qu,this.net=Zu,this.text=Ju,this.ui=ju,this._$promise=new Promise(t=>{document.readyState==="loading"?window.addEventListener("DOMContentLoaded",()=>t(),{once:!0}):t()})}async load(t,u=null){await Promise.all([this._$promise]),await Ll(t,u)}async createRootMovieClip(t=240,u=240,s=60,n=null){return await Promise.all([this._$promise]),Nl(t,u,s,n)}async captureToCanvas(t,u=null){return await _l(t,u)}}"next2d"in window||(console.log("%c Next2D Player %c 2.13.1 %c https://next2d.app","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),window.next2d=new Ul);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next2d/player",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.1",
|
|
4
4
|
"description": "Experience the fast and beautiful anti-aliased rendering of WebGL. You can create rich, interactive graphics, cross-platform applications and games without worrying about browser or device compatibility.",
|
|
5
5
|
"author": "Toshiyuki Ienaga<ienaga@next2d.app> (https://github.com/ienaga/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,20 +43,20 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"fflate": "^0.8.2",
|
|
45
45
|
"htmlparser2": "^10.0.0",
|
|
46
|
-
"@next2d/cache": "2.13.
|
|
47
|
-
"@next2d/core": "2.13.
|
|
48
|
-
"@next2d/display": "2.13.
|
|
49
|
-
"@next2d/events": "2.13.
|
|
50
|
-
"@next2d/filters": "2.13.
|
|
51
|
-
"@next2d/geom": "2.13.
|
|
52
|
-
"@next2d/media": "2.13.
|
|
53
|
-
"@next2d/net": "2.13.
|
|
54
|
-
"@next2d/render-queue": "2.13.
|
|
55
|
-
"@next2d/text": "2.13.
|
|
56
|
-
"@next2d/ui": "2.13.
|
|
46
|
+
"@next2d/cache": "2.13.1",
|
|
47
|
+
"@next2d/core": "2.13.1",
|
|
48
|
+
"@next2d/display": "2.13.1",
|
|
49
|
+
"@next2d/events": "2.13.1",
|
|
50
|
+
"@next2d/filters": "2.13.1",
|
|
51
|
+
"@next2d/geom": "2.13.1",
|
|
52
|
+
"@next2d/media": "2.13.1",
|
|
53
|
+
"@next2d/net": "2.13.1",
|
|
54
|
+
"@next2d/render-queue": "2.13.1",
|
|
55
|
+
"@next2d/text": "2.13.1",
|
|
56
|
+
"@next2d/ui": "2.13.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@eslint/eslintrc": "^3.3.
|
|
59
|
+
"@eslint/eslintrc": "^3.3.3",
|
|
60
60
|
"@eslint/js": "^9.39.1",
|
|
61
61
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
62
62
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
|
67
67
|
"@typescript-eslint/parser": "^8.48.0",
|
|
68
68
|
"@vitest/web-worker": "^4.0.14",
|
|
69
|
+
"@webgpu/types": "^0.1.66",
|
|
69
70
|
"eslint": "^9.39.1",
|
|
70
71
|
"eslint-plugin-unused-imports": "^4.3.0",
|
|
71
72
|
"globals": "^16.5.0",
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { Next2D } from "@next2d/core";
|
|
3
3
|
if (!("next2d" in window)) {
|
|
4
|
-
console.log("%c Next2D Player %c 2.13.
|
|
4
|
+
console.log("%c Next2D Player %c 2.13.1 %c https://next2d.app", "color: #fff; background: #5f5f5f", "color: #fff; background: #4bc729", "");
|
|
5
5
|
window.next2d = new Next2D();
|
|
6
6
|
}
|