float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
return mix(rand(fl), rand(fl + 1.0), fc);
}
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
| // 檢查是否為有內容的字串 | |
| const hasContent = (value) => { | |
| let string = toString(value||'') | |
| return string.trim() | |
| } | |
| // 最大字數限制,超過則在最後一個字數顯示 '⋯' | |
| const trim = (str, maxLength) => { | |
| let string = str||'' | |
| if(string.length > maxLength) { |
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
| const data = { | |
| // 已登入:使用者 line id | |
| // 未登入:會產 uuid(字元數要和 line id 統一字元數 33 個) | |
| userId: 'U3045e7519d146d551937a1a8532f0857', | |
| // 所有使用者 任務紀錄顏色比例 | |
| // R, G, B 加總為 1 | |
| // 沒有任務資料時,使用初始狀態 R: 1/3、G: 1/3、B: 1/3 | |
| all: { | |
| R: 0.33, |