for (i=0;i<vertexSize; i++) FragmentShader(vertexAttributes[i], uniformVariables);
ChangeAnimation: function() {
this.animationState = !this.animationState;
if (this.animationState) {
setTimeout(canvas.FakeAnimationStep,20,this);
}
},
FakeAnimationStep: function(me) {
me.AnimationStep();
},
AnimationStep: function() {
this.pct += this.pctStep;
if (this.pct >= 1.0) {
this.pct = 1.0;
this.pctStep *= -1;
}
if (this.pct <= 0.0) {
this.pct = 0.0;
this.pctStep *= -1;
}
if (this.animationState) {
setTimeout(canvas.FakeAnimationStep,20,this);
}
this.gl.uniform1f(this.pctLoc, this.pct);
this.Redisplay();
},
MakePoints: function(){
var theta, r = .6;
var data = [];
i = 0;
for(theta = 0; theta & 2*Math.PI; theta += Math.PI/100) {
var x = r*Math.cos(this.k*theta)*Math.cos(theta)
var y = r*Math.cos(this.k*theta)*Math.sin(theta);
vertex = [x,y];
data.push(vertex);
}
this.vertex = data;
return;
},
ChangeAnimation: function() {
this.animationState = !this.animationState;
if (this.animationState) {
this.timerID = setInterval(this.AutomatedAnimationStep,1,this);
} else {
clearInterval(this.timerID);
}
},
AnimationStep: function() {
this.pct += this.pctStep;
if (this.pct >= 1.0) {
this.pct = 1.0;
this.pctStep *= -1;
}
if (this.pct <= 0.0) {
this.pct = 0.0;
this.pctStep *= -1;
}
if (this.pct == 0) {
this.ChangeAnimation();
}
this.gl.uniform1f(this.pctLoc, this.pct);
this.Redisplay();
},
attribute vec4 vPosition;
uniform float percent;
varying vec4 f_Color;
void main() {
float fixedPct;
float scale = 1.0+percent;
gl_Position = vec4(vPosition.x, vPosition.y,0.0,1.0/scale);
f_Color = vec4(1.0, 0.0, 0.0, 1.0);
}
gl_Position.xyz *= scale;