diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index fdabad2..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.vscode/.DS_Store b/.vscode/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/.vscode/.DS_Store and /dev/null differ diff --git a/10/index.html b/10/index.html new file mode 100644 index 0000000..d475a53 --- /dev/null +++ b/10/index.html @@ -0,0 +1,10 @@ + + + + Tennjs + + + + + + \ No newline at end of file diff --git a/10/script.js b/10/script.js new file mode 100644 index 0000000..19fa594 --- /dev/null +++ b/10/script.js @@ -0,0 +1,12 @@ +let canvas = document.querySelector("#canvas"); +let ctx = canvas.getContext("2d"); +let width = canvas.width; +let height = canvas.height; +const BALL_SIZE = 5; +let ballPosition = {x: 20, y: 30}; +function draw() { +ctx.fillStyle = "black"; ctx.fillRect(0, 0, width, height); + ctx.fillStyle = "white"; + ctx.fillRect(ballPosition.x, ballPosition.y, BALL_SIZE, BALL_SIZE); + } +draw(); \ No newline at end of file diff --git a/8/index.html b/8/index.html new file mode 100644 index 0000000..63f7328 --- /dev/null +++ b/8/index.html @@ -0,0 +1,11 @@ + + + + Event Handlers + + +

Hello World!

+

ow ow ow ow ow

+ + + \ No newline at end of file diff --git a/8/index2.html b/8/index2.html new file mode 100644 index 0000000..2c2c9eb --- /dev/null +++ b/8/index2.html @@ -0,0 +1,23 @@ + + + + Event Handlers + + + +

Hello World!

+ +

+
+ + + \ No newline at end of file diff --git a/8/script.js b/8/script.js new file mode 100644 index 0000000..b3dae9f --- /dev/null +++ b/8/script.js @@ -0,0 +1,16 @@ +let heading = document.querySelector("#main-heading"); +heading.addEventListener("click", () => { + console.log("You clicked the heading!"); +}); + +let para = document.querySelector("#para"); +para.addEventListener("click", () => { + console.log("Charlie bit me!"); +}); +document.querySelector("em").addEventListener("click", () =>{ + console.log("You clicked the em element!"); + }); +document.querySelector("body").addEventListener("click", () => { + console.log("You clicked the body element!"); + }); + \ No newline at end of file diff --git a/8/script2.js b/8/script2.js new file mode 100644 index 0000000..473d151 --- /dev/null +++ b/8/script2.js @@ -0,0 +1,26 @@ +let wordList = document.querySelector("#word-list"); +let sentence = document.querySelector("#sentence"); +wordList.addEventListener("click", event => { + let word = event.target.textContent; + sentence.textContent += word; + sentence.textContent += " "; +}); +let box = document.querySelector("#box"); +let currentX = 0 +let currentY = 0 +document.querySelector("html").addEventListener("keydown", e => { + +if (e.repeat === true){ + return + } else if (e.key == "w") { + currentY -= 5; + } else if (e.key == "a") { + currentX -= 5; + } else if (e.key == "s") { + currentY += 5; + } else if (e.key == "d") { + currentX += 5; +} + box.style.left = currentX + "px"; + box.style.top = currentY + "px"; +}); \ No newline at end of file diff --git a/8/style2.css b/8/style2.css new file mode 100644 index 0000000..7b1501e --- /dev/null +++ b/8/style2.css @@ -0,0 +1,14 @@ +li { +cursor: crosshair; +} +li:hover { + text-decoration: underline; +} +#box { + position: fixed; + left: 0px; + top: 0px; + width: 10px; + height: 10px; + background-color: hotpink; +} \ No newline at end of file diff --git a/9/canvas.html b/9/canvas.html new file mode 100644 index 0000000..107ec0a --- /dev/null +++ b/9/canvas.html @@ -0,0 +1,9 @@ + + + + Canvas + + + + + = 300){ + forwards = false; + } + if (x <= 0){ + forwards = true + } +// y += 1; +// x %= width; +// y %= height; +} + +function draw() { + ctx.clearRect(0, 0, width, height); + drawCircle(x, y); +} +setInterval(() => { +update(); +draw(); +}, 1); \ No newline at end of file