function Circle(p, c, polar ) { var phi = polar.theta/180.0*Math.PI; p.x = c.x + polar.r * Math.cos(phi); p.y = c.y + polar.r * Math.sin(phi); return; } Redisplay: function() { var polarPoint = {"r":0, "theta":0}; var point = {"x":0, "y": 0}; var center = {"x": this.width/2, "y":this.height/2}; var start = 0, end = 360; for(polarPoint.theta=start; polarPoint.theta<end; polarPoint.theta++) { Circle(point, center, polarPonit); this.ctx.fillRect(x,y,1,1); } },
Plot Type:
<div id="canvas1Space">
var canvas = new parametricCanvas(400,400, "canvas1Space");
function parametricCanvas(width, height, locID) { // code deleted if(locID == undefined) { document.body.appendChild(canvas); } else { div = document.getElementById(locID); if (null == div) { document.body.appendChild(canvas); } else { div.appendChild(canvas); } }
var RED_END = 255, RED_START = 25, GREEN_END = 69, GREEN_START = 25, BLUE_END = 0, BLUE_START = 112; // code deleted Color: function() { var red, green, blue red = param(RED_START, RED_END, this.percent); green = param(GREEN_START, GREEN_END, this.percent); blue = param(BLUE_START, BLUE_END, this.percent); return 'rgb('+ red + ', '+ green + ',' + blue +')'; }, // code deleted // Inside each of the movement functions, this.percent is set. for(theta = 0; theta < 360; theta++) { this.percent = theta/360; var step = 0; for(x = this.center.x-this.radius; x <= this.center.x+this.radius; x++) { this.percent = step/(2*this.radius); step++; function param(start, end, t) { return Math.floor(start * (1-t) + end*t); }