remove unecessary folder
This commit is contained in:
parent
5908f1da11
commit
b7cc153384
5 changed files with 0 additions and 185 deletions
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB |
|
@ -1,18 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
canvas { border: 1px solid black; }
|
||||
</style>
|
||||
<title>Canvas tutorial</title>
|
||||
<script type="text/javascript" src="test.js">
|
||||
</script>
|
||||
</head>
|
||||
<body onload="executeTests()">
|
||||
<p>TestStar</p>
|
||||
<canvas id="TestStar" width="400" height="400"></canvas>
|
||||
<p>TestTransform</p>
|
||||
<canvas id="TestTransform" width="400" height="400"></canvas>
|
||||
<canvas id="TestFillRect" width="300" height="300"></canvas>
|
||||
</body>
|
||||
</html>
|
|
@ -1,64 +0,0 @@
|
|||
%!
|
||||
% Example of rotation... draws 36 lines in a circular pattern
|
||||
|
||||
0 10 360 { % Go from 0 to 360 degrees in 10 degree steps
|
||||
newpath % Start a new path
|
||||
|
||||
gsave % Keep rotations temporary
|
||||
144 144 moveto
|
||||
rotate % Rotate by degrees on stack from 'for'
|
||||
72 0 rlineto
|
||||
stroke
|
||||
grestore % Get back the unrotated state
|
||||
|
||||
} for % Iterate over angles
|
||||
|
||||
showpage
|
||||
|
||||
/box {
|
||||
newpath
|
||||
moveto
|
||||
72 0 rlineto
|
||||
0 72 rlineto
|
||||
-72 0 rlineto
|
||||
closepath
|
||||
} def
|
||||
|
||||
% Specify font for text labels
|
||||
/Helvetica findfont 40 scalefont setfont
|
||||
|
||||
gsave
|
||||
40 40 translate % Set origin to (40, 40)
|
||||
0 0 box stroke % Draw box at new origin...
|
||||
77 0 moveto
|
||||
(Translated) show % and label
|
||||
grestore
|
||||
|
||||
gsave
|
||||
100 150 translate % Translate origin to (100, 150)
|
||||
30 rotate % Rotate counter-clockwise by 30 degrees
|
||||
0 0 box stroke % Draw box...
|
||||
75 0 moveto
|
||||
(Translated & Rotated) show % and label
|
||||
grestore
|
||||
|
||||
gsave
|
||||
40 300 translate % Translate to (40, 300)
|
||||
0.5 1 scale % Reduce x coord by 1/2, y coord left alone
|
||||
0 0 box stroke % Draw box...
|
||||
75 0 moveto
|
||||
(Translated & Squished) show % and label
|
||||
grestore
|
||||
|
||||
gsave
|
||||
100 450 translate % Set origin to (300, 300)
|
||||
45 rotate % Rotate coordinates by 45 degrees
|
||||
0.5 1 scale % Scale coordinates
|
||||
0 0 box stroke % Draw box
|
||||
75 0 moveto
|
||||
(Everything) show
|
||||
grestore
|
||||
|
||||
showpage
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 592 KiB |
|
@ -1,103 +0,0 @@
|
|||
function toDegree(radians) {
|
||||
return radians * 180 / Math.PI;
|
||||
}
|
||||
function toRadians(degree) {
|
||||
return degree * Math.PI / 180;
|
||||
}
|
||||
|
||||
function draw(test){
|
||||
var canvas = document.getElementById(test.name);
|
||||
if (canvas.getContext){
|
||||
var gc = canvas.getContext('2d');
|
||||
test(gc)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function executeTests() {
|
||||
draw(TestStar)
|
||||
draw(TestTransform)
|
||||
draw(TestFillRect)
|
||||
}
|
||||
|
||||
function TestStar(gc) {
|
||||
for(i = 0.0 ; i < 360; i = i + 10) {// Go from 0 to 360 degrees in 10 degree steps
|
||||
gc.beginPath() // Start a new path
|
||||
gc.save() // Keep rotations temporary
|
||||
gc.translate(144, 144)
|
||||
gc.rotate(i * (Math.PI / 180.0)) // Rotate by degrees on stack from 'for'
|
||||
gc.moveTo(0, 0)
|
||||
gc.lineTo(72, 0)
|
||||
gc.stroke()
|
||||
gc.restore() // Get back the unrotated state
|
||||
}
|
||||
}
|
||||
|
||||
function TestTransform(gc) {
|
||||
|
||||
gc.save()
|
||||
gc.translate(40, 40) // Set origin to (40, 40)
|
||||
gc.beginPath()
|
||||
gc.moveTo(0,0)
|
||||
gc.lineTo(72,0)
|
||||
gc.lineTo(72, 72)
|
||||
gc.lineTo(0, 72)
|
||||
gc.closePath()
|
||||
gc.stroke()
|
||||
gc.restore()
|
||||
|
||||
gc.save()
|
||||
gc.translate(100, 150) // Translate origin to (100, 150)
|
||||
gc.rotate(30* (Math.PI / 180.0)) // Rotate counter-clockwise by 30 degrees
|
||||
gc.beginPath()
|
||||
gc.moveTo(0,0)
|
||||
gc.lineTo(72,0)
|
||||
gc.lineTo(72, 72)
|
||||
gc.lineTo(0, 72)
|
||||
gc.closePath() // Draw box...
|
||||
gc.stroke()
|
||||
gc.restore()
|
||||
|
||||
gc.save()
|
||||
gc.translate(40, 300) // Translate to (40, 300)
|
||||
gc.scale(0.5, 1) // Reduce x coord by 1/2, y coord left alone
|
||||
gc.beginPath()
|
||||
gc.moveTo(0,0)
|
||||
gc.lineTo(72,0)
|
||||
gc.lineTo(72, 72)
|
||||
gc.lineTo(0, 72)
|
||||
gc.closePath() // Draw box...
|
||||
gc.stroke()
|
||||
gc.restore()
|
||||
|
||||
gc.save()
|
||||
gc.translate(300, 300) // Set origin to (300, 300)
|
||||
gc.rotate(45* (Math.PI / 180.0)) // Rotate coordinates by 45 degrees
|
||||
gc.scale(0.5, 1) // Scale coordinates
|
||||
gc.beginPath()
|
||||
gc.moveTo(0,0)
|
||||
gc.lineTo(72,0)
|
||||
gc.lineTo(72, 72)
|
||||
gc.lineTo(0, 72)
|
||||
gc.closePath() // Draw box
|
||||
gc.stroke()
|
||||
gc.restore()
|
||||
}
|
||||
function TestFillRect(gc) {
|
||||
gc.moveTo(95,95)
|
||||
gc.lineTo(195,95)
|
||||
gc.lineTo(195, 195)
|
||||
gc.lineTo(95, 195)
|
||||
gc.lineTo(95, 95)
|
||||
|
||||
|
||||
gc.moveTo(105,105)
|
||||
gc.lineTo(105, 205)
|
||||
gc.lineTo(205, 205)
|
||||
gc.lineTo(205,105)
|
||||
gc.lineTo(105, 105)
|
||||
|
||||
gc.fill()
|
||||
|
||||
|
||||
}
|
Loading…
Reference in a new issue