Skip to content

Instantly share code, notes, and snippets.

View chentingjuan's full-sized avatar

JenniferJuan chentingjuan

  • Taiwan
View GitHub Profile
@chentingjuan
chentingjuan / artwork.js
Last active September 29, 2022 18:34
line messages
// 檢查是否為有內容的字串
const hasContent = (value) => {
let string = toString(value||'')
return string.trim()
}
// 最大字數限制,超過則在最後一個字數顯示 '⋯'
const trim = (str, maxLength) => {
let string = str||''
if(string.length > maxLength) {
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,
@chentingjuan
chentingjuan / GLSL-Noise.md
Created February 7, 2022 15:39 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

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);
}