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 img2pdf | |
| import os | |
| dirname = "." | |
| imgs = [] | |
| for i in range(143): | |
| path = os.path.join(dirname, str(i + 1) + ".jpg") | |
| if os.path.isdir(path): | |
| continue | |
| imgs.append(path) |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>WebGL NFT</title> | |
| <meta | |
| name="viewport" | |
| content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" | |
| /> | |
| <meta property="og:image" content="spikes.gif" /> |
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
Show hidden characters
| { | |
| "ECSY System": { | |
| "scope": "javascript", | |
| "prefix": "sys", | |
| "body": [ | |
| "export class ${1:SystemName} extends System {", | |
| " execute(delta, time) {", | |
| " const ${2:entities} = this.queries.${2:entities}.results;", | |
| "", | |
| " for (let i = 0; i < ${2:entities}.length; i++) {" |
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
| setInterval(() => window.dispatchEvent(new CustomEvent('refreshData', { 'detail': | |
| { | |
| "world": { | |
| "enabled": true | |
| }, | |
| "lastExecutedSystem": "RendererSystem", | |
| "numEntities": 18, | |
| "systems": [ | |
| { | |
| "name": "EnvironmentSystem", |
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
| var entity = world.createEntity(); | |
| // 0 | |
| var component = entity.addComponent(ComponentB); | |
| component.value = 23; | |
| component.other = 'test', | |
| // 1 | |
| entity.addComponent(ComponentA); | |
| entity.addComponent(ComponentB, {value: 23, other: 'test'}); |
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
| <html> | |
| <head> | |
| <script src="https://rawcdn.githack.com/MozillaReality/immersive-custom-elements/v0.1.0/build/immersive-custom-elements.js"></script> | |
| </head> | |
| <body> | |
| <img-360 src="360-landscape.jpg" width="640" height="360"></img-360> | |
| <video-360 src="myvideo.mp4" width="640" height="360"></video-360> | |
| </body> | |
| </html> |
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
| class Vector3 { | |
| constructor(x, y, z) { | |
| this.set(x,y,z); | |
| } | |
| copy(src) { | |
| this.x = src.x; | |
| this.y = src.y; | |
| this.z = src.z; | |
| } |
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
| { | |
| "ECSY System": { | |
| "scope": "javascript", | |
| "prefix": "sys", | |
| "body": [ | |
| "export class ${1:SystemName} extends System {", | |
| " init() {", | |
| " return {", | |
| " queries: {", | |
| " ${2:entities}: { components: [${3:Component}] }", |
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 existsInArray(array, items) { | |
| var all = true; | |
| for (i = 0; i < items.length; i++) { | |
| all &= array.indexOf(items[i]) !== -1; | |
| } | |
| return all; | |
| } | |
| if (!existsInArray(['a', 'c'], ['c'])) { |
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
| //----------------------------------------------------------------------------- | |
| // Loop measuring delta and total time with perf.now() | |
| //----------------------------------------------------------------------------- | |
| var prevTime = performance.now(); | |
| var total = 0; | |
| for (var i=0;i< 1000; i++) { | |
| var newTime = performance.now(); | |
| var delta = newTime - prevTime; | |
| total += delta; | |
| prevTime = newTime; |
NewerOlder