jspsych/plugins/jspsych-rdk.js
//Draw the dots on the canvas after they're updated

Draw the dots on the canvas after they're updated
Draw the dots on the canvas after they ' re updated
function draw() {
    		var dotArray = dotArray2d[currentSetArray[currentApertureNumber]];
			for (var i = 0; i < nDots; i++) {
				dot = dotArray[i];
				ctx.beginPath();
				ctx.arc(dot.x, dot.y, dotRadius, 0, Math.PI * 2);
				ctx.fillStyle = dotColor;
				ctx.fill();
			}
		    if(fixationCross === true){
		    	ctx.beginPath();
		    	ctx.lineWidth = fixationCrossThickness;
		    	ctx.moveTo(canvasWidth/2 - fixationCrossWidth, canvasHeight/2);
		    	ctx.lineTo(canvasWidth/2 + fixationCrossWidth, canvasHeight/2);
		    	ctx.fillStyle = fixationCrossColor;
		    	ctx.stroke();
		    	ctx.beginPath();
		    	ctx.lineWidth = fixationCrossThickness;
		    	ctx.moveTo(canvasWidth/2, canvasHeight/2 - fixationCrossHeight);
		    	ctx.lineTo(canvasWidth/2, canvasHeight/2 + fixationCrossHeight);
		    	ctx.fillStyle = fixationCrossColor;
		    	ctx.stroke();
		    }
	      	if(border === true){
	        	if(apertureType === 1 || apertureType === 2){
	          		ctx.lineWidth = borderThickness;
	          		ctx.strokeStyle = borderColor;
	          		ctx.beginPath();
	          		ctx.ellipse(apertureCenterX, apertureCenterY, horizontalAxis+(borderThickness/2), verticalAxis+(borderThickness/2), 0, 0, Math.PI*2);
	          		ctx.stroke();
	        	}
	        	if(apertureType === 3 || apertureType === 4){
	          		ctx.lineWidth = borderThickness;
	          		ctx.strokeStyle = borderColor;
	          		ctx.strokeRect(apertureCenterX-horizontalAxis-(borderThickness/2), apertureCenterY-verticalAxis-(borderThickness/2), (horizontalAxis*2)+borderThickness, (verticalAxis*2)+borderThickness);
	        	}
      		}
		}
function draw ( ) { var dotArray = dotArray2d [ currentSetArray [ currentApertureNumber ] ] ; for ( var i = 0 ; i < nDots ; i ++ ) { dot = dotArray [ i ] ; ctx . beginPath ( ) ; ctx . arc ( dot . x , dot . y , dotRadius , 0 , Math . PI * 2 ) ; ctx . fillStyle = dotColor ; ctx . fill ( ) ; } if ( fixationCross === true ) { ctx . beginPath ( ) ; ctx . lineWidth = fixationCrossThickness ; ctx . moveTo ( canvasWidth / 2 - fixationCrossWidth , canvasHeight / 2 ) ; ctx . lineTo ( canvasWidth / 2 + fixationCrossWidth , canvasHeight / 2 ) ; ctx . fillStyle = fixationCrossColor ; ctx . stroke ( ) ; ctx . beginPath ( ) ; ctx . lineWidth = fixationCrossThickness ; ctx . moveTo ( canvasWidth / 2 , canvasHeight / 2 - fixationCrossHeight ) ; ctx . lineTo ( canvasWidth / 2 , canvasHeight / 2 + fixationCrossHeight ) ; ctx . fillStyle = fixationCrossColor ; ctx . stroke ( ) ; } if ( border === true ) { if ( apertureType === 1 || apertureType === 2 ) { ctx . lineWidth = borderThickness ; ctx . strokeStyle = borderColor ; ctx . beginPath ( ) ; ctx . ellipse ( apertureCenterX , apertureCenterY , horizontalAxis + ( borderThickness / 2 ) , verticalAxis + ( borderThickness / 2 ) , 0 , 0 , Math . PI * 2 ) ; ctx . stroke ( ) ; } if ( apertureType === 3 || apertureType === 4 ) { ctx . lineWidth = borderThickness ; ctx . strokeStyle = borderColor ; ctx . strokeRect ( apertureCenterX - horizontalAxis - ( borderThickness / 2 ) , apertureCenterY - verticalAxis - ( borderThickness / 2 ) , ( horizontalAxis * 2 ) + borderThickness , ( verticalAxis * 2 ) + borderThickness ) ; } } }
Draw the dots on the canvas after they're updated
Draw the dots on the canvas after they ' re updated
//Load in the current set of dot array for easy handling
 //Loop through the dots one by one and draw them
 //Draw the fixation cross if we want it
 //Horizontal line
 //Vertical line
 //Draw the border if we want it
 //For circle and ellipse
 //End of if circle or ellipse
 //For square and rectangle
 //End of if square or 
 //End of if border === true
 //End of draw
