Hi there, welcome to my personal website. My name is Jonathan Edgecombe and I enjoy programming, gaming and graphics/website design. This website is a place where I share some of my projects and other interests.
A project i'm working on with Graham. It uses an Arduino Uno Microcontroller to do all the processing.
A pure javascript spinner in just 630 characters of code using the canvas element!
<canvas id="c" width="64" height="64"></canvas><script type="text/javascript">var q=document.getElementById('c').getContext('2d');function a(i,z){q.beginPath();q.arc(0,-21,z,0,Math.PI,true);q.arc(0,-11,z,0,Math.PI,false);q.closePath();if(z==2){q.fillStyle="rgb("+(255-(i*10))+","+(255-(i*10))+","+(255-(i*10))+")";}else{q.fillStyle="rgb("+(150+(z*20))+","+(150+(z*20))+","+(150+(z*20))+")";}q.fill();q.fillRect(-z,-21,z*2,10);}function c(z){for(var i=0;i<12;i++){a(i,z);q.rotate(-Math.PI*(1/6));}}function b(){q.clearRect(-48,-48,142,142);c(5);c(4);c(3);c(2);q.rotate(Math.PI*(1/6));}q.translate(30,30);setInterval(b,50);</script><canvas id="ct" width="400" height="32"></canvas>
<script type="text/javascript">
var ctx = document.getElementById('ct').getContext('2d');
function Point(x, y) {
this.x = x;
this.y = y;
}
var no = 5;
var Points = new Array();
for (var q = 0; q < no; q++) {
Points[q] = new Array();
}
Points[0][0] = new Point(0,0);
Points[0][1] = new Point(100,0);
Points[0][2] = new Point(200,64);
Points[0][3] = new Point(300,0);
Points[0][4] = new Point(400,0);
var detail = 100;
ctx.beginPath();
ctx.moveTo(0,0);
for (var i = 0; i < (detail+1); i++) {
for (var u = 1; u < (detail-2); u++) {
var c = no-u;
for (var z = 0; z < c; z++) {
Points[u][z] = new Point(0,0);
Points[u][z].x = Points[u-1][z].x-(i/detail)*(Points[u-1][z].x - Points[u-1][z+1].x);
Points[u][z].y = Points[u-1][z].y-(i/detail)*(Points[u-1][z].y - Points[u-1][z+1].y);
}
}
ctx.lineTo(Points[no-1][0].x, Points[no-1][0].y);
}
ctx.stroke();
</script>