Last active
January 3, 2016 05:09
-
-
Save crongro/8413995 to your computer and use it in GitHub Desktop.
Programming Education using Canvas
This file contains 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
<body> | |
<section> | |
<canvas id="tutorial" width="500" height="500"></canvas> | |
</section | |
</body> |
This file contains 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
/* 0. what is this ? */ | |
//canvas , rectangle | |
/* 1. draw basic */ | |
drawRect(50,30,50,50); //x,y,width.height | |
/* 2. draw circle */ | |
fillColor("blue"); | |
drawRect(50,120,100,100); //x,y,width.height | |
/* 3. draw circle with other color */ | |
//face | |
fillColor("white"); | |
drawCircle(100,300,50); | |
//eye | |
fillColor("red"); | |
drawCircle(80,280,10); | |
drawCircle(120,280,10); | |
//mouth | |
drawHalfCircle(100,310,30); |
This file contains 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
body { text-align:center;} | |
section { width : 100%; margin : 0px auto;} | |
canvas { border: 1px solid black; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment