From 408e7e0196daa17bf57364fad9bb119fbb9f0a90 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 30 Sep 2017 18:46:31 -0400 Subject: [PATCH] begin frame drawing --- gyrio/index.html | 24 ++---------------------- gyrio/index.js | 36 +++++++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/gyrio/index.html b/gyrio/index.html index 46f844c..9999254 100644 --- a/gyrio/index.html +++ b/gyrio/index.html @@ -1,9 +1,8 @@ -<<<<<<< HEAD - Foxnet + Gyrio @@ -13,23 +12,4 @@ - -======= - - - - - Foxnet - - - - - - - - - - - - ->>>>>>> 3bcdb922df05952a164b59bdb8ad9d2aa2785b4d + \ No newline at end of file diff --git a/gyrio/index.js b/gyrio/index.js index a608e99..3a3d28f 100644 --- a/gyrio/index.js +++ b/gyrio/index.js @@ -1,14 +1,16 @@ - var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); -canvas.width = screen.width; -canvas.height = screen.height; +canvas.width = window.innerWidth; +canvas.height = window.innerHeight; + +var frames = [ + "0" +]; function randInt(min,max) { return Math.floor(Math.random() * (max - min + 1)) + min; } - function generateString() { var final = ""; var length = randInt(50,100); @@ -18,10 +20,25 @@ function generateString() { return final; } -console.log(generateString()); +function generateFrames(string, speed) { + // Speed is in bits per second -ctx.fillStyle = "#000"; -ctx.fillRect(0,0, canvas.width, canvas.height); +} + +function drawFrame(frame) { + ctx.beginPath(); + var frame = frames[frame]; + for(var i = 0; i < frame.length; i++) { + if(frame[i] === "0") { + console.log("asdf"); + ctx.beginPath(); + ctx.moveTo(0,canvas.height/2); + ctx.lineTo(canvas.width,canvas.height/2); + ctx.strokeStyle="#4CAF50"; + ctx.stroke(); + } + } +} function getWebsite(geturl) { xmlhttp=new XMLHttpRequest(); @@ -29,3 +46,8 @@ function getWebsite(geturl) { xmlhttp.send(); var data = xmlhttp.responseText; } + +ctx.fillStyle = "#000"; +ctx.fillRect(0,0, canvas.width, canvas.height); +generateFrames(generateString()); +drawFrame(0);