
ๆฅฝใใๆ้ใ๏ผ
็งใฏใใคใ็ซใๅคงๅฅฝใใงใ็นใซ็ซใฎ้กใๆใใฎใๅคงๅฅฝใใงใใใ ใใฉใผใ ใใฉใคใณใใใใณใพใฃใใ็ฐใชใ่กจ็พใ็ฐใชใใ ใผใใใใใใซๅคๆดใใพใใ ็งใฎA4ใทใผใใฏ้็ใพใงๅผใๅฏใใใใพใใใ ใใใฆใใใใง็งใฏๆ่ฟ้ ญใๆใใใพใใ-ใใใใใใชใใ้ๅฃ็ซใฎใธใงใใฌใผใฟใผใไฝใใชใใฐใฉใใงใใ๏ผ ใใฟใณใใฏใชใใฏใใฆใใฉใณใใ ใช็ซใฎ้กใๆใใพใใ ใงใใใ ใใฉใณใใ ใง้ข็ฝใใ ใใฎใใใชใใฎใไฝใๆนๆณใ่ฆใฆใฟใพใใใใ
็งใฏ็ซใ็ซๆๅฅฝๅฎถใใ้กใใใพใใ
JSใจCanvasใงใในใฆใ่กใใพใใใๅๆๅใๆงๆใชใฉใฎใณใผใใฏๆไพใใพใใใ ใใใฏใคใณใฟใผใใใไธใงใใฃใฑใใงใใใ็ซใๆใๆนๆณใ่ใใฆใใพใใใญ๏ผ
ใใใซไพฟๅฉใชใใใซใใใใคใใฎๅฎ็พฉๆธใฟ้ขๆฐใฎใฟใๆไพใใพใใ
function add(func, scale){ Graphics.ctx.scale(scale.x, scale.y); func(Graphics.ctx); Graphics.ctx.scale(1, 1); }
ใญใฃใณใในใฎใตใคใบใๅคๆดใใไฝใใๆใใฆใๅ ใซๆปใใพใใ
function drawircle(ctx, pos, radius, fillColor, strokeColor, lineWidth) { ctx.beginPath(); ctx.arc(center.x - pos.x, center.y + pos.y, radius, 0, 2*Math.PI, false); ctx.fillStyle = fillColor; ctx.fill(); ctx.lineWidth = lineWidth; ctx.strokeStyle = strokeColor; ctx.stroke(); }
ใใใฆใใใใฏๅ/ๅใๆใใฆใใพใใ ใพใใไฝใ็นๅฅใชใใจใฏใใใพใใใใใใใฏใในใฆใใใงใฉใใงใไฝ็พไธๅใ่ชญใใใจใใงใใพใใใใใซ็ซใซ่กใใพใใใ๏ผ
ในใใใ1-้ ญ
้ ญใใๅงใใพใใ ้ ญใใใใพใใ๏ผ ๅๅจใ ๅฐใ็ตใใใๆกๅคงใใใใจใใงใใพใใ
ในใใญใผใฏใฎๅคชใใ่จญๅฎใใใใจใใงใใพใใใใใ่กใใพใใ ใใใฆใ็ดฐ้จใๅฐใใใใพใใใณใผใใฎใณใกใณใใ่ฆใฆใใ ใใใ
ใณใผใๅ จไฝใซใณใกใณใใไปใใใใฆใใใ็่งฃใซๅ้กใฏใชใใจๆใใพใใ
// var radius = Math.sRandom(60, 70); // var scaleCircle = {x:Math.sRandom(1,1.1),y:Math.sRandom(0.9,1.0)}; // var whiteColor = "#fff"; var blackColor = "#000"; // add(function(ctx){ // (Math.sRandom(0, 100) < 95 ? blackColor : whiteColor) - , , , , .. . , . drawircle(ctx, {x:0,y:0}, radius, whiteColor, (Math.sRandom(0, 100) < 95 ? blackColor : whiteColor), Math.sRandom(2,5)); }, scaleCircle);
้ ญใจ็ปๅ ดใ

็ถใใพใใใ๏ผ
ในใใใ2-่ณ
็ซใฎ่ณใฏใ้ๅฃใฎๆใ่กจ็พๅ่ฑใใช่ฆ็ด ใฎ1ใคใงใใ ใใใใฃใฆใ่ณใฎๅน ใ็ฐใชใใๅ่ปขใใ่ณใ็ฐใชใใปใฉใ่กจ็พใฎๅคๆงๆงใฏๅคงใใใชใใพใใ
ใใพใใ
//, , var dir = {x:0, y:radius}; // var angleOne = Math.PI + Math.PI/Math.sRandom(2, 5); // var pointR1 = VectorRot(dir, angleOne); // , var pointR2 = VectorRot(dir, angleOne - Math.PI/Math.sRandom(4, 7)); // var topPointR = {x:((pointR1.x + pointR2.x) / 2)+Math.sRandom(-10, 10), y:pointR2.y - 30 + Math.sRandom(0, 5)}; // add(function(ctx){ // ctx.beginPath(); ctx.strokeStyle = strokeColor; ctx.fillStyle = fillColor; ctx.lineWidth = Math.sRandom(2, 4); topPointR = {x:topPointR.x+Math.sRandom(-1,5), y:topPointR.y+Math.sRandom(-5,5)}; ctx.moveTo(center.x + pointR1.x,center.y + pointR1.y); ctx.lineTo(center.x + topPointR.x,center.y + topPointR.y); ctx.lineTo(center.x + pointR2.x,center.y +pointR2.y); ctx.fill(); ctx.stroke(); // ctx.beginPath(); ctx.strokeStyle = strokeColor; ctx.fillStyle = fillColor; ctx.lineWidth = Math.sRandom(2, 4); var topPointL = VectorXInvert({x:topPointR.x+Math.sRandom(-5,5), y:topPointR.y+Math.sRandom(-5,5)}); var pointL1 = VectorXInvert(pointR1); var pointL2 = VectorXInvert(pointR2); ctx.moveTo(center.x + pointL1.x,center.y + pointL1.y); ctx.lineTo(center.x + topPointL.x,center.y + topPointL.y); ctx.lineTo(center.x + pointL2.x,center.y +pointL2.y); ctx.fill(); ctx.stroke(); }, {x:1,y:1});
IIIiiใฏๆฌกใฎใจใใใงใใ

ใใงใซ็ซใซไผผใฆใใพใใใญ๏ผ
ในใใใ3-ๅฃใฒใ
่กจ็พๅใฎ2็ช็ฎใฏใ่ณใซ็ถใใฆใ็ซใฎ้กใฎ่ฆ็ด ใงใใ ใใใไฝใใฎใฏ้ฃใใใใจใงใฏใใใพใใใใใใไฟกใใใใชใใใใซ่ฆใใใใใซใใใฎใใใ้ฃใใใชใใพใใ 1ใคใฎใฉใณใใ ใชๅฎถใงใฏใงใใพใใใใใ็ทๅฝขใฎ็ตๆใๅพใใซใฏใใตใคใฏใซใใญใใฃใฆใใซใฆใณใฟใผใงใใคใณใใ่จ็ฎใใๅฟ ่ฆใใใใพใใ
// // , // - var pointsR = []; // var count = Math.floor(Math.sRandom(3, 5)); for (var i = 0; i < count; i++) { // , / var dir = {x:0, y:radius/Math.sRandom(1.6,1.9)}; // , , var angleOne = Math.PI/(2 + ((i+1)/4)); // var pointR1 = VectorRot(dir, angleOne); // y , count // var y = pointR1.y+(i < count / 2 ? -Math.sRandom(8, 25) : Math.sRandom(7, 15) ); // pointsR.push({begin:pointR1, end:{x:pointR1.x - Math.sRandom(60, 100),y:y}}); } // var lineWidth = Math.sRandom(0.5, 2); // add(function(ctx){ // for (var i = 0; i < pointsR.length; i++) { ctx.beginPath(); ctx.strokeStyle = strokeColor; ctx.fillStyle = fillColor; ctx.lineWidth = lineWidth; ctx.moveTo(center.x - pointsR[i].begin.x,center.y + pointsR[i].begin.y); ctx.lineTo(center.x - pointsR[i].end.x,center.y + pointsR[i].end.y); ctx.stroke(); } // for (var i = 0; i < pointsR.length; i++) { ctx.beginPath(); ctx.strokeStyle = strokeColor; ctx.fillStyle = fillColor; ctx.lineWidth = lineWidth; var pointLBegin = VectorXInvert(pointsR[i].begin); var pointLEnd = VectorXInvert(pointsR[i].end); ctx.moveTo(center.x - pointLBegin.x,center.y + pointLBegin.y); ctx.lineTo(center.x - pointLEnd.x,center.y + pointLEnd.y); ctx.stroke(); } }, {x:1,y:1});
VectorXInvert้ขๆฐใฏ็ ฉใใใใใใพใใใxๅใฎ็ฐใชใ่ฆ็ด ใ้ ป็นใซๅๆ ใใๅฟ ่ฆใใใใใใx = -xใๅฎ่กใใๅ็ดใช้ขๆฐใไฝๆใใใพใใ
็ซใใฉใฎใใใซๆใใใใ่ฆใฆใฟใพใใใใ

ในใใใ4-ๅฃ
็พๅฎ็ใซ่กใใฎใฏ้ๅธธใซ้ฃใใใใใๅฃใฎ็ทใๅณๅผ็ใซไฝๆใใพใใใใฐใฉใใฃใใฏใฎๆ็ปใซใฏไฝฟ็จใใพใใ
ๅฃใฎ็ทใๅผใใณใผใใๆธใใพใใ ใใธใงๆฒ็ทใงไฝๆใ
//--- // . + 2 // P0 // P3 | iP3 // | | | // P2--P1--iP2 var P0 = {x:center.x, y:center.y}; var P1 = {x:center.x, y:center.y + Math.sRandom(40, 65)}; var P2 = {x:center.x - Math.sRandom(29, 36),y: center.y + 40}; var P3 = {x:center.x - Math.sRandom(20, 40), y:center.y + Math.sRandom(23, 28)}; var iP2 = {x:center.x + Math.sRandom(29, 36),y: center.y + 40}; var iP3 = {x:center.x + Math.sRandom(20, 40), y:center.y + Math.sRandom(23, 28)}; // add(function(ctx){ ctx.beginPath(); ctx.strokeStyle = strokeColor; ctx.fillStyle = fillColor ; ctx.lineWidth = Math.sRandom(1,3); ctx.moveTo(P0.x,P0.y ); ctx.bezierCurveTo(P1.x, P1.y, P2.x, P2.y, P3.x, P3.y); ctx.stroke(); ctx.beginPath(); ctx.strokeStyle = strokeColor; ctx.fillStyle = fillColor ; ctx.lineWidth = Math.sRandom(1,3); ctx.moveTo(P0.x,P0.y ); ctx.bezierCurveTo(P1.x, P1.y, iP2.x, iP2.y, iP3.x, iP3.y); ctx.stroke(); }, {x:1,y:1});
ไฝใ่ตทใใฃใใฎใ่ฆใฆใฟใพใใใใ ๅฟ่ใใปใใฎๅฐใๆฎใฃใฆใใพใ๏ผ

ในใใใ5-้ผป
้ผปใฏ้ผปใงใใ ๅฐใใชๅใจไธ่งๅฝขใฎ2ใคใฎใชใใทใงใณใงๆงๆใใพใใใใ ๅใฏใใพใ้ ป็นใซ่กจ็คบใใใพใใใ ใพใใๆฅฝใใฟใฎใใใซใ
ใใกใใใ่ฒใๅซใใฆใฉใณใใ ใซๆททใใฆใใใพใใพใช้ผปใๅกใใพใ-ๅกใใคใถใใ่ผช้ญใ ใใซใใพใใ ใใใใใฎ็ซใๅฟ ่ฆใงใใใญ๏ผ
// - , var chance = Math.sRandom(0, 100); if(chance < 98) { // var scale = {x:Math.sRandom(0.9,1.3), y:Math.sRandom(0.9,1.3)}; // var pointR ={x:Math.sRandom(4,5)*scale.x,y:Math.sRandom(-5,-4)*scale.y}; // var pointL ={x:Math.sRandom(-4,-5)*scale.x,y:Math.sRandom(-5,-4)*scale.y}; // var bottomPoint ={x:0,y:Math.sRandom(5,6)*scale.y}; // add(function(ctx){ ctx.beginPath(); ctx.strokeStyle = strokeColor; ctx.fillStyle = (Math.sRandom(0, 100) > 50 ? fillColor : strokeColor); ctx.lineWidth = Math.sRandom(1,3); ctx.moveTo(center.x + pointR.x,center.y + 5 + pointR.y); ctx.lineTo(center.x + bottomPoint.x,center.y + 5 + bottomPoint.y); ctx.lineTo(center.x + pointL.x,center.y + 5 + pointL.y); ctx.closePath(); ctx.fill(); ctx.stroke(); }, {x:1,y:1}); } else { // add(function(ctx){ drawircle(ctx, {x:0,y:0}, Math.sRandom(7, 10), strokeColor, strokeColor, 1); }, {x:1,y:1}); }
็งใใกใฎ็ซใฏๅพใ ใซ็ซใซๅคใใฃใฆใใพใใ ใใใฏๅใฐใใใใจใงใใ

ในใใใ6-็ฎ
็ฎใฏ่ค้ใงใใ ใใใใๆ็ปใใใฎใฏ้ฃใใใใใพใใใ2ใคใฎใใธใงๆฒ็ทใ ใใงใใ ใใใใ้ใใ็ฎใ่ฟฝๅ ใใๅฟ ่ฆใใใใพใใ็ซใฏ็ ใใใจใใงใใๅ ดๅใซใใฃใฆใฏ็็ฎใ้ใใใจใใงใใพใใ ใใใฆใใใใฏ่กใใใชใใใฐใชใใพใใใ ไปๅใฏๅใชใ็ซใงใใใใณใผใใฏใใใพใใใ ๅคง้ใฎๅ ดๅใ็งใฏ่ชญ่ ใซๅคง้ใฎใใญในใใ้ๅฑใใใใใใใพใใใ ๆๅพใซใ่ฆใใใฝใผในใไธใใใใพใใ ใใใฆใ็งใใกใฏไฝใ่ตทใใฃใใใ่ฆใฆใใพใใ

็ซใฏใใงใซใใใซใใพใใใใใๅฐใ่ฃ ้ฃพใๅ ใใพใใ
ในใใใ7-้ ฌใฎๅฃใฒใใใคใณใ
ใใชใใฏ็ฅใฃใฆใใใใใฎใใใชใใฎใใใใพใใ ็บ็ใใ็ขบ็ใฏๅฝ็ถ100๏ผ ใงใฏใใใพใใใ ใใใใณใผใใๆฌกใซ็ตๆใงใใ
ใณใผใใฏๅ็ดใงใ-้ผปใใ็นๅฎใฎ่ท้ขใซ็นใๅๆฃใใใใ ใใงใใ
if(Math.sRandom(0, 100) > 60) { add(function(ctx){ for (var i = 0; i < Math.sRandom(5, 7); i++) { var P = {x:Math.sRandom(20, 40),y:Math.sRandom(0, 30)}; drawircle(ctx, P, 1, strokeColor, strokeColor, 1); } for (var i = 0; i < Math.sRandom(5, 7); i++) { var P = {x:-Math.sRandom(20, 40),y:Math.sRandom(0, 30)}; drawircle(ctx, P, 1, strokeColor, strokeColor, 1); } }, {x:1,y:1}); }
็ตๆ๏ผ

ในใใใ8-ใใณใฐ
ๆใ ใไธใซๆฐๆฌใฎ็ทใๅผใใพใใ ่จ่ใง่ชฌๆใใใฎใฏ้ฃใใใงใใใณใผใใ่ฆใฆใไฝใ่ตทใใใใ่ฆใฆใใ ใใใ
if(Math.sRandom(0, 100) > 75) { add(function(ctx){ for (var i = 0; i < Math.sRandom(3, 5); i++) { // var radiusVector = {x:0,y:-radius}; // // radiusVector = VectorRot(radiusVector, Math.sRandom(-0.01, 0.01)) // var P0 = {x:Math.sRandom(-25, 25), y: radiusVector.y}; var P1 = {x:Math.sRandom(-25, 25), y: Math.sRandom(-50, -40)}; // var lineWidth = Math.sRandom(0.5, 1.5); // drawLine(ctx, P0, P1, strokeColor, strokeColor, lineWidth); } }, {x:1,y:1}); }
ใใใงใใญ

ในใใใ8-ใใซใพใใฏใใฆ
ใพใใใใใฏใใ ใฎๆฅฝใใฟใฎใใใงใใใ็งใฏใใใซ่ฟฝๅ ใใใใจใ่ใใๅผใจ้ใ่ฟฝๅ ใใใใจใซใใพใใใ ๅณๅฏใซๅคๆญใใชใใงใใ ใใใ็งใฏๆฅฝใใใงใใพใ:)
ใใคใใฎใใใซใใณใผใใใใใฆ็ซใจไธ็ทใซ็พใใๅ็ใ
// // var chanceBottom = Math.sRandom(0, 100); if(chanceBottom > 50) { var chance = Math.sRandom(0, 100); if(chance > 90) { // - + , var P = {x:0,y:radius}; var P0 = {x:Math.sRandom(20, 45), y:radius- Math.sRandom(13, 22)}; var P1 = {x:Math.sRandom(20, 45), y:radius+ Math.sRandom(13, 22)}; add(function(ctx){ var color = (Math.sRandom(0, 100) > 50 ? fillColor : strokeColor); ctx.beginPath(); ctx.strokeStyle = strokeColor; ctx.fillStyle = color; ctx.lineWidth = Math.sRandom(2, 5); ctx.moveTo(center.x + Px,center.y + Py); ctx.lineTo(center.x + P0.x,center.y + P0.y); ctx.lineTo(center.x + P1.x,center.y + P1.y); ctx.closePath(); ctx.stroke(); ctx.fill(); ctx.beginPath(); ctx.strokeStyle = strokeColor; ctx.fillStyle = color; ctx.lineWidth = Math.sRandom(2, 5); ctx.moveTo(center.x - Px,center.y + Py); ctx.lineTo(center.x - P0.x,center.y + P0.y); ctx.lineTo(center.x - P1.x,center.y + P1.y); ctx.closePath(); ctx.stroke(); ctx.fill(); drawircle(ctx, P, Math.sRandom(6, 12), (Math.sRandom(0, 100) > 50 ? fillColor : strokeColor), strokeColor, Math.sRandom(1, 3)); }, {x:1,y:1}); } } else { // var chance = Math.sRandom(0, 100); if(chance > 90) { // - , . , , var P = {x:0,y:radius}; var P0 = {x:Math.sRandom(8, 15), y:radius+ Math.sRandom(23, 29)}; var P1 = {x:-P0.x, y:P0.y}; var P3 = {x:0,y:P0.y + Math.sRandom(0, 7)}; add(function(ctx){ drawircle(ctx, P3, Math.sRandom(2, 6), (Math.sRandom(0, 100) > 50 ? fillColor : strokeColor), strokeColor, Math.sRandom(1, 3)); var color = (Math.sRandom(0, 100) > 50 ? fillColor : strokeColor); ctx.beginPath(); ctx.strokeStyle = strokeColor; ctx.fillStyle = color; ctx.lineWidth = Math.sRandom(2, 5); ctx.moveTo(center.x + Px,center.y + Py); ctx.lineTo(center.x + P0.x,center.y + P0.y); ctx.lineTo(center.x + P1.x,center.y + P1.y); ctx.closePath(); ctx.stroke(); ctx.fill(); }, {x:1,y:1}); } }
ใ่ฆงใฎใจใใใ่ค้ใชใใฎใฏใชใใๅนพไฝๅญฆ็ใชๅฝข็ถใงใใ
็ซใใใชใใใฐใใณใผใใฏ้ๅฑใชใใฎใซใชใใพใใๅผใๆใฃใ็ซใใใใจใใพใใใ๏ผ

ใใใใซ
ใใใงใ็ซใซใคใใฆใฎ่ฉฑใ็ตใใใพใใใ
githubใฎใณใผใใฏๆฌกใฎใจใใใงใใgithub.com / MagistrAVSH / random-cat
ใใใใใในใฆใฎไฝๆฅญใฎ็ตๆใใฏใชใใฏใงใใพใ๏ผ magistravsh.github.io/random-cat
ใใใฆไปใใขใใฟใผใใ้ฃใณๆฃใฃใฆใ็ซใstrokeใงใฆใใ ใใ๏ผ :)