-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
67 changed files
with
13,425 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
max_line_length = 120 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
module.exports = { | ||
root: true, | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: ["./tsconfig.json"], | ||
}, | ||
env: { | ||
browser: true, | ||
node: true, | ||
mocha: true, | ||
}, | ||
globals: { 'chai': true }, | ||
ignorePatterns: [ | ||
'**/{node_modules,libs}', | ||
'*.js', | ||
'*.d.ts', | ||
], | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:promise/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
], | ||
plugins: [ | ||
"@typescript-eslint", | ||
], | ||
rules: { | ||
"arrow-parens": ["error", "as-needed"], | ||
"array-bracket-spacing": ["error", "never"], | ||
"brace-style": ["error", "1tbs", { "allowSingleLine": true }], | ||
"comma-dangle": ["error", "always-multiline"], | ||
"curly": "error", | ||
"generator-star-spacing": ["error", { | ||
"before": false, | ||
"after": true, | ||
"anonymous": "neither", | ||
"method": "neither" | ||
}], | ||
"new-parens": "error", | ||
"no-multi-spaces": [ | ||
"error", | ||
{ | ||
"ignoreEOLComments": true | ||
} | ||
], | ||
"no-console": ["error", { "allow": ["info", "warn", "error", "debug", "trace"] }], | ||
"no-inner-declarations": "error", | ||
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1 }], | ||
"no-trailing-spaces": "error", | ||
"no-void": ["error", { "allowAsStatement": true }], | ||
"padding-line-between-statements": [ | ||
"error", | ||
{ "blankLine": "always", "prev": "*", "next": ["return", "break"] }, | ||
{ "blankLine": "never", "prev": "*", "next": ["case", "default"] }, | ||
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" }, | ||
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] } | ||
], | ||
"promise/always-return": "off", | ||
// TODO:: will be opened | ||
"promise/catch-or-return": "off", | ||
"prefer-rest-params": "off", | ||
"semi": ["error", "always"], | ||
"space-in-parens": ["error", "never"], | ||
"@typescript-eslint/comma-spacing": "error", | ||
"@typescript-eslint/no-namespace": "off", | ||
// TODO:: will be ["error", "never"] | ||
"import/prefer-default-export": "off", | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
// TODO:: will be opened | ||
"@typescript-eslint/ban-types": "off", | ||
"@typescript-eslint/indent": ["error", 2], | ||
"@typescript-eslint/keyword-spacing": "error", | ||
// TODO:: will be opened | ||
"@typescript-eslint/no-var-requires": "off", | ||
// TODO:: will be opened | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
// TODO:: will be opened | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-empty-interface": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
"@typescript-eslint/no-unnecessary-type-arguments": "error", | ||
"@typescript-eslint/no-unnecessary-type-assertion": "error", | ||
"@typescript-eslint/no-unnecessary-type-constraint": "error", | ||
// TODO:: will be opened | ||
"@typescript-eslint/no-unsafe-return": "off", | ||
// TODO:: will be opened | ||
"@typescript-eslint/no-unsafe-member-access": "off", | ||
"@typescript-eslint/no-unsafe-call": "off", | ||
"@typescript-eslint/object-curly-spacing": ["error", "always"], | ||
"@typescript-eslint/prefer-includes": "error", | ||
"@typescript-eslint/prefer-reduce-type-parameter": "error", | ||
"@typescript-eslint/prefer-ts-expect-error": "error", | ||
"@typescript-eslint/return-await": "error", | ||
// TODO:: will be opened | ||
"@typescript-eslint/restrict-plus-operands": "off", | ||
// TODO:: will be opened | ||
"@typescript-eslint/restrict-template-expressions": "off", | ||
"@typescript-eslint/space-infix-ops": ["error", { "int32Hint": false }], | ||
// TODO:: will be "error" | ||
"@typescript-eslint/strict-boolean-expressions": "off", | ||
"@typescript-eslint/no-floating-promises": ["error", { "ignoreVoid": true, "ignoreIIFE": true }], | ||
"@typescript-eslint/quotes": ["error", "single"], | ||
// TODO:: will be opened | ||
"@typescript-eslint/require-await": "off", | ||
"@typescript-eslint/space-before-blocks": "error", | ||
"@typescript-eslint/space-before-function-paren": ["error", "always"], | ||
"@typescript-eslint/type-annotation-spacing": "error", | ||
"@typescript-eslint/unbound-method": "off", | ||
// TODO:: will be opened | ||
"@typescript-eslint/no-misused-promises": "off", | ||
"@typescript-eslint/prefer-regexp-exec": "off", | ||
"@typescript-eslint/semi": "error", | ||
// TODO:: will be opened | ||
"@typescript-eslint/member-delimiter-style": ["error", { | ||
"multiline": { | ||
"delimiter": "comma", | ||
"requireLast": true | ||
}, | ||
"singleline": { | ||
"delimiter": "comma", | ||
"requireLast": false | ||
} | ||
}], | ||
"@typescript-eslint/no-unsafe-assignment": "off", | ||
// TODO:: will be opened | ||
"@typescript-eslint/no-unsafe-argument": "off", | ||
"@typescript-eslint/consistent-type-imports": [ | ||
"error", | ||
{ | ||
"prefer": "type-imports", | ||
"disallowTypeAnnotations": false, | ||
}, | ||
], | ||
}, | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### macOS template | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
### Node template | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# next.js build output | ||
.next | ||
|
||
.idea | ||
.history | ||
dist | ||
dist-rollup | ||
test/dev/* | ||
node/index.js |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
PATH=$PATH:/usr/local/bin:/usr/local/sbin | ||
npx commitlint --edit "$1" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
PATH=$PATH:/usr/local/bin:/usr/local/sbin | ||
npx lint-staged |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"{src,fallback,test}/**/*.{ts,mjs}": [ | ||
"eslint --cache --fix", | ||
"sh -c 'tsc -b tsconfig.check.json'" | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Galacean Effects JSON definition | ||
|
||
## Environment Setup | ||
|
||
- Node.js `>= 10.0.0` | ||
|
||
## Development | ||
|
||
``` bash | ||
# 1. Install dependencies (first time) | ||
npm install | ||
# 2. Build | ||
npm run build | ||
``` | ||
|
||
## Testing | ||
|
||
``` bash | ||
npm run test | ||
``` | ||
|
||
> Open browser and open: http://localhost:9003/test/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import type { CameraContent, CameraPositionOverLifetime } from '../src/item/camera-item'; | ||
import type { RotationOverLifetime } from '../src'; | ||
import { deleteEmptyValue, ensureFixedNumber, ensureFixedVec3 } from './utils'; | ||
|
||
export function getStandardCameraContent (model: any): CameraContent { | ||
const opt = model.options; | ||
const ret: CameraContent = { | ||
options: { | ||
fov: opt.fov!, | ||
far: opt.far!, | ||
near: opt.near!, | ||
clipMode: opt.clipMode, | ||
}, | ||
}; | ||
|
||
const velocityOverLifetime = model.velocityOverLifetime; | ||
|
||
if (velocityOverLifetime || model.transform?.path) { | ||
const positionOverLifetime: CameraPositionOverLifetime = { | ||
path: ensureFixedVec3(model.transform?.path), | ||
linearX: ensureFixedNumber(velocityOverLifetime?.translateX), | ||
linearY: ensureFixedNumber(velocityOverLifetime?.translateY), | ||
linearZ: ensureFixedNumber(velocityOverLifetime?.translateZ), | ||
}; | ||
|
||
deleteEmptyValue(positionOverLifetime); | ||
ret.positionOverLifetime = positionOverLifetime; | ||
} | ||
|
||
const rol = model.rotationOverLifetime; | ||
|
||
if (rol) { | ||
const rotationOverLifetime: RotationOverLifetime = { | ||
separateAxes: rol.separateAxes, | ||
x: ensureFixedNumber(rol?.rotateX), | ||
y: ensureFixedNumber(rol?.rotateY), | ||
z: rol.separateAxes ? ensureFixedNumber(rol?.rotateZ) : ensureFixedNumber(rol.rotation), | ||
}; | ||
|
||
deleteEmptyValue(rotationOverLifetime); | ||
ret.rotationOverLifetime = rotationOverLifetime; | ||
} | ||
|
||
return ret; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { ensureFixedNumber, ensureFixedVec3, forEach } from './utils'; | ||
import type { FilterParams } from '../src/item/filter-item'; | ||
|
||
const convertParams = [ | ||
'strength', | ||
'bloomAddon', | ||
'colorAddon', | ||
'period', | ||
'waveMovement', | ||
'colorThreshold', | ||
'xOpacity', | ||
'yOpacity', | ||
'feather', | ||
]; | ||
const pathParams = [ | ||
'path', 'position', | ||
]; | ||
|
||
export function getStandardFilterContent (filter: any): FilterParams { | ||
const ret: Record<string, any> = {}; | ||
|
||
forEach(filter, function (val, key) { | ||
if (convertParams.includes(key)) { | ||
ret[key] = ensureFixedNumber(val); | ||
} else if (pathParams.includes(key)) { | ||
ret[key] = ensureFixedVec3(val); | ||
} else { | ||
ret[key] = val; | ||
} | ||
}); | ||
|
||
return ret as FilterParams; | ||
} |
Oops, something went wrong.