User:Menno Harder/Canvas: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with " Samba class File:blok1.png Knock one time File:Blok2.png Knock two times File:Blok3.png Clap one time [[File:Blok...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[http://www.mennoharder.nl/canvasmenno.html | Samba class]]
<p style="margin-left:0; font-size: 12px; font-family:Baskerville; text-align:left;">
[[http://www.mennoharder.nl/canvasmenno.html | Samba class]]<br/>
[[File:blok1.png]] Knock one time<br>
[[File:Blok2.png]] Knock two times<br/>
[[File:Blok3.png]] Clap one time<br/>
[[File:Blok4.png]] Clap two times<br/>
<source lang="html4strict">
function draw() {
    c = document.getElementById("c2");
    p = c.getContext("2d");
    hands = 1;
    x = 20;
    y = 20;
    function functienaam(){
    if (hands < 25) {
        //console.log(hands);
        if (hands % 3 == 0){
          p.fillRect(x,y,20,20);
        }else{
          p.strokeRect(x,y,20,20);
        }
        x = x + 50;
        //hands++;
        if (x > 400) {
            x = 20;
            y = y + 50;
        }
    }
    if (hands >= 24 && hands<48) {
        //console.log(hands);
        if (hands % 2  == 0 || hands % 3 ==0){
          p.strokeRect(x,y,15,15);
        }else{
          p.strokeRect(x,y,20,20);
        }
        x = x + 50;
        //hands++;
        if (x > 400) {
            x = 20;
            y = y + 50;
        }
    }
        if (hands >= 47 && hands<71) {
        //console.log(hands);
        if (hands % 3  == 0 || hands % 2 ==0){
          p.strokeRect(x,y,20,20);
          p.strokeRect(x,y,15,15);
          p.strokeRect(x,y,10,10);
        }else{
          p.fillRect(x,y,20,20);
        }
        x = x + 50;
        //hands++;
        if (x > 400) {
            x = 20;
            y = y + 50;
        }
    }
        if (hands >= 70 && hands<94) {
        //console.log(hands);
        if (hands % 2  == 0 || hands % 4 ==0){
          p.strokeRect(x,y,15,15);
        }else{
          p.fillRect(x,y,20,20);
        }
        x = x + 50;
        //hands++;
        if (x > 400) {
            x = 20;
            y = y + 50;
        }
    }


[[File:blok1.png]] Knock one time
    hands++;


[[File:Blok2.png]] Knock two times
  }
 
    setInterval(functienaam, 700);
[[File:Blok3.png]] Clap one time
}
 
</source>
[[File:Blok4.png]] Clap two times

Latest revision as of 22:59, 13 December 2012

[| Samba class]
Blok1.png Knock one time
Blok2.png Knock two times
Blok3.png Clap one time
Blok4.png Clap two times

function draw() {
    c = document.getElementById("c2");
    p = c.getContext("2d");
    hands = 1;
    x = 20;
    y = 20;
    function functienaam(){
    if (hands < 25) {
        //console.log(hands);
        if (hands % 3 == 0){
          p.fillRect(x,y,20,20);
        }else{
          p.strokeRect(x,y,20,20);
        }
        x = x + 50;
        //hands++;
        if (x > 400) {
            x = 20;
            y = y + 50;
        }
    }
    if (hands >= 24 && hands<48) {
        //console.log(hands);
        if (hands % 2  == 0 || hands % 3 ==0){
          p.strokeRect(x,y,15,15);
        }else{
          p.strokeRect(x,y,20,20);
        }
        x = x + 50;
        //hands++;
        if (x > 400) {
            x = 20;
            y = y + 50;
        }
    }
        if (hands >= 47 && hands<71) {
        //console.log(hands);
        if (hands % 3  == 0 || hands % 2 ==0){
          p.strokeRect(x,y,20,20);
          p.strokeRect(x,y,15,15);
          p.strokeRect(x,y,10,10);
        }else{
          p.fillRect(x,y,20,20);
        }
        x = x + 50;
        //hands++;
        if (x > 400) {
            x = 20;
            y = y + 50;
        }
    }
        if (hands >= 70 && hands<94) {
        //console.log(hands);
        if (hands % 2  == 0 || hands % 4 ==0){
          p.strokeRect(x,y,15,15);
        }else{
          p.fillRect(x,y,20,20);
        }
        x = x + 50;
        //hands++;
        if (x > 400) {
            x = 20;
            y = y + 50;
        }
    }

    hands++;

  }
    setInterval(functienaam, 700);
}