Created
February 1, 2016 05:44
-
-
Save potato4d/d758e8e1dc3ac2163d00 to your computer and use it in GitHub Desktop.
カレンダーの画像作る奴。holidayを変えたら色が変わり、右クリで保存が可能
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>CalendarMaker</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.21/p5.min.js"></script> | |
<script src="sketch.js"></script> | |
</head> | |
<body> | |
</body> | |
</html> |
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
var holidays = [1, 10, 20, 30]; | |
var maxDay = 31; | |
function setup() { | |
createCanvas(320,226); | |
translate(13, 8); | |
} | |
function draw() { | |
background(255); | |
fill(255); | |
rect(-13,-8,319,225); | |
push(); | |
for(var week=0;week<5;week++){ | |
for(var day=1;day<=7;day++){ | |
if(day+week*7 > maxDay) return; | |
fill(255); | |
if(holidays.indexOf(day+week*7) >= 0) fill(255, 100, 100); | |
rect((day-1)*42, week*42, 42, 42); | |
textAlign(CENTER); | |
fill(0); | |
text(""+(day+week*7), (day-1)*42+21, week*42+26); | |
} | |
} | |
pop(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment