Need help with looping and canvas. Loop doesn't load.

Reply Wed 16 Jan, 2013 01:48 am
First off, here is the source:

<script type="text/javascript">

<canvas id="myCanvas" width="200" height="100" style="border:0px solid #d3d3d3;">Your browser does not support the HTML5 canvas tag.</canvas>

<script type="text/javascript">
function binRun(){
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var a = 80;
var b = 0;
for(i = 0;i < 6;i++){
x = b * 2;
x = a;
y = a * 2;
y = b;


So, the goal here is to use a mix of <canvas> and a loop that reassigns variable values in order to draw a binary square onto the page. The only thing is, I seem to not at all be able to get the loop to work the way I want it to. I always either get a blank screen, or a loading symbol near the mouse as if it never completes the cycles in javascript.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 926 • Replies: 0
No top replies


Related Topics

How does one uninstall a program? - Question by Woollcott
Adding a JavaScript 'Copy to Clipboard' - Discussion by BobbyDouglas
JavaScript: OnSelect question - Discussion by neocode
Javascript - Control C textarea script - Discussion by Craven de Kere
2018123 - Question by ibk1995
javascript loops for - Question by vartul agnihotri
  1. Forums
  2. » Need help with looping and canvas. Loop doesn't load.
Copyright © 2021 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/18/2021 at 08:21:11