WEBã¢ããªã®äœãæ¹ãïœã«ãŒã¬ããïœ
WEBãã©ãŠã¶ã®é²åã«ããããã©ãŠã¶äžã§åãããã¢ããªãå¢ããŠããŸãããããã§ã¯ããã®ãããªWEBã¢ããªã¯ã©ããã£ãŠäœãã°ããã®ãïŒã«ã€ããŠè§£èª¬ããŠãããŸããã©ããªãã®ãäœããïŒå®æãããã®ã¯ã«ãŒã¬ãã WEBããŒã«ã«ãŠå ¬éããŠããŸããææ°
2020/1/162020/1/19ãµãŒãã¹, ãµã€ã
ããããã¯app.jså ã«èšè¿°ããŠãããŸãã
ã«ãŒã¬ããã¯ã©ã®ãããªæµãã§åäœããã®ã§ãããããèããŠã¿ããšã
- ã¹ã¿ãŒããã¿ã³ãæŒããããŸã§åŸ æ©
- ã¹ã¿ãŒããã¿ã³ãæŒãããŠå é
- æ倧é床ãšãªãå®éã«
- ã¹ããããã¿ã³ãæŒãããŠæžé
- åæ¢ã»çµæ衚瀺 ãšãªããŸããã¹ããããã¿ã³ã¯å éäžã§ãæŒããããã«ããŠããããããããŸããã 以äž5ã€ã®ç¶æ ãåæå(enum)ã§å®çŸ©ããŠãããŸãããŸããçŸåšã®ç¶æ ãä¿æããå€æ°ãèšããŸããç¶æ ã®åæå€ã¯waitingãšããŠãããŸãã
var Mode = { waiting: 0, acceleration: 1, constant: 2, deceleration: 3, result: 4 }; var mode = Mode.waiting; ã«ãŒã¬ãããåããŠããæäžã«ãã«ãŒã¬ããã®èšå®ãå€æŽããããããããŸãããããã«åããŠããã©ãŒã ã®å 容ãå€æ°ã«ä¿åããŠãããŸãã ïŒã€ã®é ç®ã«ã€ã
- é ç®å
- 確ç
- è²
ãæã£ãŠããã°ããã®ã§ããããããä¿æãã空ã®é åãäœæããŸãã
var nameList = ; var probabilityList = ; var colorList = ; ãšããããå¿ èŠã«ãªããããªå€æ°ã¯ãã®ããã«ãªããŸãã ããã§ã¯ãããžãã¯ãæžããŠãããŸãããã
åºæ¬èšå®
ãŸããæç»é å(canvas)ã®ãµã€ãºãèšå®ããŸãããã³ãã¬ãŒãã®äžã« createCanvas(600,300) ãšããèšè¿°ããããŸãããå°ãé«ãã足ããªãã®ã§ã300ã400ã«å€æŽããŸãã
ãã³ãã¬ãŒãå ã®drawé¢æ°ã¯ãæ¯ãã¬ãŒã åŒã°ããŸãã以äžããã®äžã«æç»åŠçãæžããŠãããŸãã
æ¯ãã¬ãŒã ãèæ¯ãçœè²ã«ãããã®ã§ãfillã§å¡ãã€ã¶ãè²ãæå®ããŠãrectã§å®éã«æç»ããŸããwidth(å¹ )ãheight(é«ã)å€æ°ã«ã¯ãèªåçã«canvasã®ãµã€ãºãå ¥ããŸããä»åã¯widthã«ã¯600ãheightã«ã¯400ãèªåçã«ä»£å ¥ãããŸãã
次ã«ã«ãŒã¬ããã®äžå¿ãèšå®ããŸããä»åã¯åçŽã«canvasã®äžå¿ãšããã®ã§x座æšã¯width/2ãy座æšã¯height/2ã ã移åããŸãã
function draw(){ fill(255,255,255); rect(0,0,width,height); translate(width/2, height/2); //… } ãã®ã³ãŒã以éãåç¹ã(width/2, height/2)ã«ç§»åããŸããã€ãŸããäŸãã°(10, 20)ã«ç¹ãæã€ãšããã³ãŒããæžããšãèªåçã«(width/2 + 10, height/2 + 20)ãšãã座æšã«ç¹ãæããããšããããšã§ãã
ãã©ãŒã ããŒã¿ã®ååŸ
å ã»ã©çšæããããã©ãŒã ããŒã¿ä¿åçšé åã«å¯ŸããŠä»£å ¥åŠçãè¡ã£ãŠãããŸãã
ãã®åã«ãå ¥åãããå€ã劥åœãã©ããæ€èšŒããvalidationé¢æ°ãäœã£ãŠãããŸãããã æ€èšŒå 容ãšããŠã¯ããé ç®åã空æ¬ã§ã¯ãªããããå²åã0ãã倧ãããã®ïŒã€ãšããŸãã
function validation(){ var badflag = false; $(’.name’).each(function(){ if($(this).val()==""){ badflag = true; } }); $(’.ratio’).each(function(){ if(!($(this).val()>0)){ badflag = true; } }); if(badflag){ alert(‘é ç®åãšå²åãæ£ããèšå®ããŠãã ããã’); return 1; } return 0; } validationãæžããã®ã§ã次ã¯å®éã«ãã©ãŒã å 容ãååŸããŠãããŸãã ãŸããåé ç®ã®ç¢ºçèšç®ã¯ãã©ãŒã äœæã®éšåã§æ¢ã«äœæããŠããŸãã åããããªåŠçãªã®ã§èª¬æã¯å²æããŸãã ããã«å ããŠãé ç®åãåæ§ã«ååŸããŠãããŸãã
function dataFetch(){ var ratioSum = 0.0; $(’.item’).each(function(){ var ratio = $(this).find(’.ratio’).val()-0; ratioSum += ratio; }); nameList = ; probabilityList = ; $(’.item’).each(function(){ var name = $(this).find(’.name’).val(); var ratio = $(this).find(’.ratio’).val()-0; nameList.push(name); probabilityList.push(ratio/ratioSum); }); //… } é£ããã®ã¯ããããã§ããåé ç®ã«å¯ŸããŠã«ãŒã¬ããã§å²ãåœãŠãããè²ãèšå®ããã®ã§ãããèŠãããããã«ã¯ã©ã®ãããªé è²ãè¡ãã°è¯ããèããŠã¿ãŸãã
åºæ¬çã«äººéã®ç®ã¯ãåããããªè²ãé£ãåããšèŠã«ãããšæããŸãããã®ãããã§ããã ãè²çžç°ã§é ãè²ãé£ã«æ¥ãããã«ããŠãããŸããã€ãŸãè£è²ã«è¿ãè²ãé£ã«ãããšèŠããããšããããã§ãã è²çžãæ±ãããRGBã§ã¯ãªããããã§ã¯HSLè²ç©ºéã䜿çšããŠãHueïŒè²çžïŒãSaturationïŒåœ©åºŠïŒãLightnessïŒèŒåºŠïŒãããŸãèšå®ããŠããããšãšããŸãã
圩床ãšèŒåºŠã¯ãšãããã眮ããŠãããŠãè²çžã®å€ã䞊ã¹ãŠãããŸãã æ¹éãšããŠã¯ã0~255ã®è²çžãé ç®æ°ã§nçåããŸãããããŠããã®äžãã 0çªç®ãn/2çªç®ã1çªç®ãn/2+1çªç®ã⊠ãšé çªã«å€ãååŸãã䞊ã¹æ¿ããŠãããŸãã
n=6ã®å Žåã
0: 0
1: 127
2: 42
3: 170
4: 85
5: 212
ãšããå€ãšãªããŸããåé ç®ã®è²çžãããŸãé¢ããŠããããšãããããŸãã
nãå¥æ°ã®å ŽåãããŸãå ·åã«ããã°ã©ã ããŠãããŸãã COLOR_ADJãšããå®æ°ãè¿œå ããŸãã
//datafetché¢æ°ã®å€ const COLOR_ADJ = 0.4; //datafetché¢æ°ã®äž //… var colors = ; len = nameList.length; for(var i=0;i<len;i++){ colors.push(Math.floor(255/len*i)); } colorList = ; if(len%2==0){ for(var i=0;i<len;i+=2){ colorListi = colorsMath.floor(i/2); } for(var i=1;i<len;i+=2){ colorListi = colorsMath.floor(i/2 + len/2); } }else{ for(var i=0;i<len;i+=2){ colorListi = colorsMath.floor(i/2); } for(var i=1;i<len;i+=2){ colorListi = colorsMath.floor(i/2)+Math.floor(len/2)+1; } } cssColorSet();//åŸè¿° ããã§ããã©ãŒã ã®è²è¡šç€ºéšåã«è²ãåæ ãããããšæããŸãã è²ã®èšç®åŒã決ããªããšãããªãã®ã§ã以äžã®ããã«æ±ºããŸããã
H=äžèšã®è²çžS=255-ãšããå®æ°*äžèšã®è²çžL=128
Lã¯128ã§çŽè²ãšãªããŸããSã¯255ã§çŽè²ã0ã§ç°è²ã«ãªããŸããSããªããã®ãããªåŒã«ãããã«ã€ããŠã¯ããã£ãŠã¿ããšããããŸãããèµ€è²ãšçŽ«è²ã®åºå¥ãã€ãã«ããã£ãããã§ãããšããã®ããè²çžã255ãŸã§ãããšãè²çžç°ãäžåšããŠããŸããã»ãŒåãè²ãšãªã£ãŠããŸããŸããããã§ããã®ããã«èšå®ããŠå·®ãã€ããŸããã
ãããŸã§èšèšããäžã§ãå®éã«CSSã«è²ãé©çšããŠãããŸããCSSã«å¯ŸããŠã¯ããªãã¿æ·±ã(?)RGBã§èšå®ããŠãããŸãã
function cssColorSet(){ var counter = 0; $(’.color-indicator’).each(function(){ push(); colorMode(HSL, 255); var c = color(colorListcounter,255-COLOR_ADJ*colorListcounter,128); pop(); $(this).css(‘background-color’, “rgb("+c._getRed()+”,"+c._getGreen()+","+c._getBlue()+")"); counter++; }); } cssColorSeté¢æ°ãåŒã³åºããšãè²ã®é åããèªåçã«ãã©ãŒã å ã®è²è¡šç€ºéšåã«è²ã衚瀺ãããããã«ãªããŸããã
ã«ãŒã¬ããã®æç»
æ±ãã確çã«åŸã£ãŠãåé ç®ã®é¢ç©å²åãèšå®ããŠãããŸãã å šé ç®åãããŠïŒåš(2Ï)ããããã«ããŸãã arcé¢æ°ã§å匧ãæç»ã§ããŸãã å§ç¹ã»çµç¹ã®è§åºŠãããŸãèšç®ããŠããå¿ èŠããããŸãã nçªç®ã®å匧ãæããšãã¯ã0~n-1çªç®ã®å匧ã®è§åºŠã®åãå§ç¹ãšããŠã2Ï*(nçªç®ã®é ç®ã®åœéžç¢ºç)ã ãé²ãã ãšãããçµç¹ãšããã°è¯ãã§ãããã ååŸã¯å®æ°ã§èšå®ããŠãããŸãã ããã§ãpushé¢æ°ãpopé¢æ°ã䜿çšããŠããŸããpushé¢æ°ã§çŸåšã®æç»ã«é¢ããæ å ±ãããããä¿åããŠãããŸããpopé¢æ°ãåŒã³åºããšããããã埩å ããŠãããŸããã«ã©ãŒã¢ãŒã(colorMode)ã ã£ãããå¡ãã€ã¶ãè²(fill)ã ã£ãããä¿åã»åŸ©å ããããã«äœ¿çšããŠããŸãã
const RADIUS = 100; function drawRoulette(){ var angleSum = 0.0; push(); colorMode(HSL, 255); for(var i=0;i<len;i++){ fill(colorListi,255-COLOR_ADJ*colorListi,128); arc(0,0,RADIUS*2,RADIUS*2,angleSum,angleSum+2*PI*probabilityListi); angleSum += probabilityListi*2*PI; } pop(); } ã«ãŒã¬ããã®å転ã¯ããã§ã¯èããŠããŸããã以äžã®å Žååãã®æã«åº§æšãäžžããšå転ãããåŸã«ã«ãŒã¬ãããæç»ããããšã§ãã«ãŒã¬ãããå転ããŠããããã«èŠããããã«ããŸãã
ç¶æ ã§ã®å Žååã
switchæã«ãããçŸåšã®ç¶æ ã§å Žååããè¡ããŸãã
function draw(){ fill(255,255,255); rect(0,0,width,height); translate(width/2, height/2); switch(mode){ case Mode.waiting: break; case Mode.acceleration: break; case Mode.constant: break; case Mode.deceleration: break; case Mode.result: break; } } ããããã©ã®ãããªåŠçãè¡ãã°ãããèããŠãããŸãã
ã»waitingïŒåŸ ã¡ç¶æ ïŒ ã«ãŒã¬ãããå転ããããã®ãŸãŸæç»
ã»accelerationïŒå éäžïŒ ã«ãŒã¬ããããããå é床ã§å éããã ã«ãŒã¬ãããæç» ããéã以äžã«ãªã£ãããå®éç¶æ ãžç§»è¡
ã»constantïŒå®éïŒ æ¯ãã¬ãŒã åãã ãã«ãŒã¬ããã®è§åºŠãå¢å ãã ã«ãŒã¬ãããæç»
ã»decelerationïŒæžéïŒ ã«ãŒã¬ããããããå é床ã§æžéããã ã«ãŒã¬ãããæç» éãã0ã«ãªã£ããçµæ衚瀺ç¶æ ãžç§»è¡
ã»resultïŒçµæïŒ ã«ãŒã¬ãããåæ¢ ã«ãŒã¬ãããæç» çµæãååŸããŠHTMLåŽã«è¡šç€ºããã
ã©ã®ç¶æ ã§ãã«ãŒã¬ãããæç»ããã®ã¯å€ãããªãã®ã§ãã«ãŒã¬ããæç»é¢æ°ã¯switchæã®å€ã«åºããŠãè¯ãããšã«ãªããŸããmode=Mode.resultã®å Žåã®èšè¿°ã®åŸã«drawRouletteé¢æ°ã眮ãããšã«ããŸãããã
次ã«ãå¿ èŠã«ãªãå®æ°ãæå®ããããçŸåšã®æ§ã ãªç¶æ ãæã£ãŠããå€æ°ãçšæããŠãããŸãã
//drawé¢æ°å€ const ACCEL = 0.01; //å éæã®å é床 const DECEL = 0.01; //æžéæã®å é床 const MAX_SPEED = 1.0; //æ倧é床 const DECEL_RAND_LEVEL = 10; //æžéã®ä¹±æ°ã®å¹ ãèšå® const DECEL_RAND_MAGNITUDE = 0.001; //æžéã®ä¹±æ°ã®åœ±é¿åãèšå® var speed = 0.0; var theta = 0.0; var len = 0; var resultDisplayed = false; ããã§ã¯å®è£ ããŠãããŸãã
ã»mode = Mode.accelerationã®ãšã
rotateé¢æ°ã«ãããã«ãŒã¬ãããthetaradianã ãå転ãããŸãã ç©ççãªçè§å é床éåãèããŠãspeedãšthetaãå€åãããŠãããŸãã thetaã2Ïãè¶ ãããã0<=theta<2Ï ãšãªãããã«thetaã®å€ãããããŸãã
case Mode.acceleration: if(speed<MAX_SPEED){ speed += ACCEL; }else{ mode = Mode.constant; speed = MAX_SPEED; } theta += speed; theta-=(Math.floor(theta/2/PI))*2*PI; rotate(theta); break; ã»mode = Mode.constantã®ãšã
speedã¯äžå®ã§ãã
case Mode.constant: theta += speed; theta-=(Math.floor(theta/2/PI))*2*PI; rotate(theta); break; ã»mode = Mode.decelerationã®ãšã
accelerationã®éã§ãã ãã ããããã§äžå·¥å€«ã§ããŸããæ¯ååãå é床ã§æžéãããšãã¹ã¿ãŒããã¿ã³ãšã¹ããããã¿ã³ãåãããã«æŒãã°ã«ãŒã¬ãããæ¯ååããšããã§åæ¢ããããšã«ãªã£ãŠããŸããŸããã©ã³ãã æ§ããããããããå€ãã©ã³ãã ã«å€åãããŸããããã©ã³ãã ãªæŽæ°ãååŸããé¢æ°ã¯æ¢ã«ãã³ãã¬ãŒãã«å ¥ã£ãŠããã®ã§ããããå©çšããŸãã
case Mode.deceleration: if(speed>DECEL){ speed -= DECEL+getRandomInt(-DECEL_RAND_LEVEL,DECEL_RAND_LEVEL)*DECEL_RAND_MAGNITUDE; }else{ speed = 0.0; mode = Mode.result; } theta += speed; theta-=(Math.floor(theta/2/PI))*2*PI; rotate(theta); break; ã»mode = Mode.resultã®ãšã
ã«ãŒã¬ããã¯thetaã ãå転ããç¶æ ã§æ¢ãŸã£ãŠããŸãã ã¢ãŒããããã«å ¥ã£ãæåã®ãã¬ãŒã ã ããçµæãååŸããŠHTMLåŽã«åæ ãããããšã«ããŸãã çµæã®ååŸã¯å°ãé£ããåŒã§ãã ãŸãåæãšããŠãã«ãŒã¬ããã®ç¢å°ã¯ã«ãŒã¬ããã®çäžã«ãããã®ãšããŸãã p5.jsã§ã¯ãè§åºŠã0ãšããã®ã¯æ°Žå¹³å³åãïŒâïŒãè§åºŠã®æ£æ¹åã¯æèšåãïŒâ€µïŒãšãªã£ãŠããã®ã§ãçäžïŒâïŒã¯270°ãã€ãŸã3Ï/2radianãšãªããŸãã nçªç®ã®é ç®ã®é åãçäžã«ãããã©ãããïŒã€ïŒã€å€å®ããŠãããŸããã€ãŸããnçªç®ã®é åã3Ï/2ããŸããã§ãããã©ãããå€å®ããŸãã ããã§æ³šæãå¿ èŠãªã®ã¯ãã«ãŒã¬ããã«ä¹ã£ã座æšç³»ïŒrotateåŸïŒã§ã®0°ããéæ¢ç³»ïŒrotateåïŒã§ã®270°ïœ360°ã®äžã«å ¥ã£ãŠããå Žåã§ãããã®å Žåã¯nçªç®ã®é åã3Ï/2 + 2Ï = 7Ï/2ããŸããã§ãããã©ããå€å®ããªããã°ãªããŸããã 以äžã«æ³šæããŠå€å®ããŠãããŸãã é ç®åã¯nameListã«å ¥ã£ãŠããã®ã§ãresultçªç®ã®é ç®ãåœéžãããšããã£ãå ŽåãnameListresultã§é ç®åãåãåºãããšãã§ããŸãã ãã®å€ãjQueryã§HTMLåŽã«è¡šç€ºãããŸãã
case Mode.result: rotate(theta); if(!resultDisplayed){ resultDisplayed = true; var angleSum = theta; var beforeAngleSum = theta; var result = 0; for(var i=0;i<len;i++){ angleSum += probabilityListi*2*PI; if((angleSum>3/2*PI&&beforeAngleSum<3/2*PI) || (angleSum>7/2*PI&&beforeAngleSum<7/2*PI)){ result = i; break; } beforeAngleSum = angleSum; } $(’#result’).html(nameListresult); } break; }//switchãããã§çµãã drawRoulette();//ã«ãŒã¬ããæç»é¢æ°ã¯switchã®å€ã«åºã
ã«ãŒã¬ããã®ç¢å°ã®æç»
ç¢å°ã¯ã«ãŒã¬ãããšäžç·ã«åããªãããã«ãrotateé¢æ°ãåŒã¶åã«æç»ããŸãã triangleé¢æ°ã§èµ€è²ã®äžè§åœ¢ãæç»ããŸãã ã«ãŒã¬ããã®äžå¿ãããã«ãŒã¬ããã®ååŸ+ããŒãžã³ã ãäžã«é 眮ããŸãã äžè§åœ¢ã®ãµã€ãºãšããŒãžã³ã¯å®æ°ã§èšå®ããŸãã
const TRIANGLE_SIZE = 10; const MARGIN = 10; function draw(){ fill(255,255,255); rect(0,0,width,height); translate(width/2, height/2); fill(255,0,0); push(); translate(0, -RADIUS-MARGIN); triangle(0, 0, -TRIANGLE_SIZE/2, -TRIANGLE_SIZE, TRIANGLE_SIZE/2, -TRIANGLE_SIZE); pop(); switch(mode){
ãªã»ããã»ã¹ã¿ãŒãã»ã¹ããããã¿ã³ã®å®è£
ã¹ã¿ãŒããã¿ã³ã¯modeãwaitingã®æã«æŒããããšãã¹ã¿ãŒããã¿ã³ãæ¶ããŠã¹ããããã¿ã³ãåºçŸããããããã©ãŒã æ å ±ãååŸããããmodeãaccelerationã«å€æŽãããããŸãã
function start(){ if(mode==Mode.waiting){ if(validation()==1){ return; } $(’#stop’).css(‘display’, ‘inline-block’); $(’#start’).css(‘display’, ’none’); dataFetch(); mode = Mode.acceleration; } } ã¹ããããã¿ã³ã¯modeãconstantã®æã«æŒããããšãã¹ããããã¿ã³ãæ¶ããŠmodeãdecelerationã«å€æŽããŸãã
function stop(){ if(//mode==Mode.acceleration || //å éäžã§ãã¹ããããã¿ã³ãå¹ãããã«ã¯ã³ã¡ã³ãã¢ãŠããè§£é€ mode==Mode.constant){ $(’#start’).css(‘display’, ’none’); $(’#stop’).css(‘display’, ’none’); mode = Mode.deceleration; } } ãªã»ãããã¿ã³ã¯ã¹ããŒããè§åºŠã0ã«ããããçµæ衚瀺ãåæåããããã¹ã¿ãŒããã¿ã³ã衚瀺ããããããŸãã
function reset(){ $(’#start’).css(‘display’, ‘inline-block’); $(’#stop’).css(‘display’, ’none’); theta = 0.0; speed = 0.0; mode = Mode.waiting; if(validation()==0){ dataFetch(); } $(’#result’).html(’????’); resultDisplayed = false; } ããããããã©ãŒã ã®å ¥åå 容ã®æ€èšŒãå¿ èŠãªéšåã«ã¯ãvalidationé¢æ°ãå ¥ããŠããã®è¿ãå€ã0ãã©ããã確èªããŸãã
ããŒãžãåããŠããŒãããããšããããã©ãŒã ã®åæå ¥åãèªåçã«ã«ãŒã¬ããã«å ¥ãããã«ããŠãããŸããåæã«ãããŒã»ã³ããŒãžãèšç®ãããŸãã ã«ãŒã¬ããã®åæåã«ã¯p5.jsãé¢ãã£ãŠããã®ã§ãHTMLåŽã«åæååŠçãæžãã®ã§ã¯ãªããp5.jsãæºåå®äºãšãªã£ãã®ãä¿èšŒãããã¿ã€ãã³ã°ã§åæåãããŸãããã®ããã«ã¯ãapp.jså ã®setupé¢æ°å ã«åŠçãèšè¿°ããŸãã
function setup(){ var canvas = createCanvas(600,400); canvas.parent(‘canvas’); textSize(20); stroke(0,0,0); fill(0,0,0); background(255,255,255); recalculate(); dataFetch(); }
HTMLãã¡ã€ã«ã®ä¿®æ£
é ç®ãè¿œå ã»åé€ã»å€æŽãããšãããã€modeãwaitingã®ãšãããã©ãŒã ã®å ¥åå 容ãå³æã«ãŒã¬ããåŽã«åæ ãããããã«ããŸãã 以äžã®ã³ãŒããã$(’.add’).clickãfunction rmItem(e)ã$(’#table’).on ããããã®recalculate()ã®åŸã«å ¥ããŸãã
if(mode==Mode.waiting){ dataFetch(); }
åãããŠã¿ã
ãšãã£ã¿äžã§ãšã©ãŒãåºãŠããªãããšã確èªããŠããã©ãŠã¶äžã§å®éã«åãããŠã¿ãŸããindex.htmlãå³ã¯ãªãã¯ãããã°ã©ã ããéããGoogle ChromeãéžæããŸãã
ãã®ãããªç»é¢ãåºãã°æåã§ãïŒ å®éã«åããŠã¿ããšâŠ
ãã®ããã«çµæã衚瀺ãããŸããã
ãã®ããŒãžã§ã³ã§ã¯HTMLã¯ç¹ã«è£ 食ãæœããŠããŸããããèªèº«ã§CSSãããã£ãŠã¿ãã®ãè¯ããããããŸããã
ã¹ãã³ãµãŒãªã³ã¯
æåŸã«
æè¿å¢ããŠããŠãããWEBã¢ããªããšãããã®ã®äœãæ¹ãå°ãã§ãäŒãã£ãããã§ããã幞ãã§ããp5.jsã䜿çšããããšã§ãJavaScriptã§çã®Canvasãæäœããããšãªãç°¡åã«ã¢ããªã±ãŒã·ã§ã³ãäœæã§ããŸãã®ã§ãã«ãŒã¬ãã以å€ã®ã¢ããªã¥ããã«å¿çšããŠããã ããŸããšå¬ããã§ãã
ããã§äœæããã«ãŒã¬ããã¯ãã«ãŒã¬ãã WEBããŒã« ãã¡ãã«ãŠå®éã«WEBã¢ããªãšããŠå ¬éããŠããŸãã Bootstrapã«ããè£ é£Ÿãå ããŠãããŸãã®ã§ããã²ãåèã«ããŠãã ããã
ãŸããææ°ã®ãœãŒã¹ã³ãŒãã¯GitHubã«ãŠå ¬éããŠããŸããæŽæ°ããã£ãå Žåã¯GitHubã«ã³ããããããŸãã
解説åç»ã¯YouTubeã«ãŠå ¬éããŠããŸãã
æåŸãŸã§ã芧ããã ãããããšãããããŸããã
åèæç®
p5.jsã®ãªãã¡ã¬ã³ã¹
ãã®èšäºãžã®ææ³ãæããŠãã ãã- å 容ãåå ()
- å 容ã足ããªãã£ãã圹ç«ã£ã ()
- å 容ã足ãã圹ç«ããªãã£ã ()
- æ±ããŠããèšäºã§ã¯ãªãã£ã ()
Heroku PHPã§SendGridã䜿çšããŠã¡ãŒã«éä¿¡ æ·»ä»ãã¡ã€ã«ãå¯
ã¯ããã« Heroku PHPã«ãŠã¡ãŒã«ãéä¿¡ããæãmailé¢æ°ãmb_send_mailé¢æ°ã䜿ããŸããããã®ãããå¥ã®æ¹æ³ã§ã¡ãŒã«ã…
åããœãŒã¹ã®ã¯ããªã®ã«ã¬ã€ã¢ãŠããéãæ
ïŒã€ã®ãœãŒã¹ããè€æ°ããŒãžã«ç§»æ€ããããšããããŸããã極çšã«åããœãŒã¹ã§ãã¬ã€ã¢ãŠããç°ãªã£ãŠããŸããŸãããã®å ŽåããŸãã¯DOCTYPE宣蚅
ã€ãã«Google Adsenseã§è¿œå°Ÿåºåã®èšçœ®ãå¯èœã«ïŒ
Google Adsenseã§ã¯ä»ãŸã§äžè¬ã¢ã«ãŠã³ãã«ãã远尟åºåã®èšçœ®ãçŠæ¢ããŠããŸããããšããããå æ¥Googleããçºè¡šããããç¹å¥ã®…
SSLåãèªåã§ãã£ãŠã¯ãããªãçç± HTTPSåã¯å¿ é ã§ãïŒ
SSL/TLSå(HTTPSå)ã®éèŠæ§ããæè¿ã¯ç¹ã«éç«ã£ãŠããŸãã ãšèšãã®ãã»ã»ã» ãä¿è·ãããŠããªãéä¿¡ããšè¡šç€ºãããŠããŸã …
.htaccessã®ãã£ãã·ã¥ãæ¶ããªãå Žåã®å¯ŸåŠæ³
.htaccessãã¡ã€ã«èªäœã®ãã£ãã·ã¥ã¯åãã©ãŠã¶ã§ããªããã¶ãšãæ®ãéšé¡ã®ãã¡ã€ã«ã§ããããã§ã¯Google Chromeã§ã®.hta…
Rails5ã§èªäœValidationã䜿çšãã
éå§æ¥ãçµäºæ¥ ãšããå ¥åãããããå ŽåããããããŸããç§ã®ç¥ãéãã¯ãããäžçºã§ãã£ãŠãããValidationã¯ååšããªããããèªåã§V…
CSSã§z-indexãå¹ããªãæç°¡åã«åãããã«ãªãæ¹æ³
è€æ°ã®èŠçŽ ãéãªãåããµã€ããäœããšããz-indexãæå®ãããšæããŸãããåããªãããšãå€ã ãããŸãããã®å Žåã«ã¯ãéãªãåãèŠçŽ å šéšã«…
Rails5ã§materializeã䜿çšããcheckboxã衚瀺ããæ¹æ³
Railsã䜿ããªããmaterializeãé©çšããŠcheckboxã衚瀺ããããšãããšãcheckboxãæ¶ããŠããŸãããšããããŸãã …
PHPããMySQLãå©çšããæ¹æ³ããã³ãã¬ãŒãå
äŒå¡ãµã€ããããŒã¿ããŒã¹ã䜿çšãããµã€ãã¯ãMySQLãPHPããæäœããããªãããšããã°ãã°ãããŸããä»åã¯ãé£ããããšã¯èãããç°¡åãªP…
Rails5ã§æŽæ°æãŸãã¯æ°èŠäœææã®ã¿Validationããããæ¹æ³
æ®éããŠãŒã¶ãŒç»é²åŸã«ãŠãŒã¶ãŒæ å ±ãå€æŽããããã®ç»é¢ãäœããšæããŸããç»é²æã¯åœç¶ãã¹ã¯ãŒããèšå®ããŠãããããã§ããããŠãŒã¶ãŒæ å ±å€æŽç»…
ãã²ãŒã ã®çªãã¯ã€ã³ã¹ããŒã«äžèŠïŒPCã»ã¹ããã»ã¿ãã¬ããã®ãã©ãŠã¶ã§éã¹ãHTML5ã²ãŒã ã»ã«ãžã¥ã¢ã«ã²ãŒã ã®ç¡æã²ãŒã ãµã€ãã§ãã
ãã®ãµã€ãã§ã¯é¢é£ããèšäºã®ã¿ãåéããŠããŸãããªãªãžãã«ã衚瀺ããã«ã¯ã以äžã®ãªã³ã¯ãã³ããŒããŠéããŠãã ãããWEBã¢ããªã®äœãæ¹ãïœã«ãŒã¬ããïœ