Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is an html problem Code1: body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin :
This is an html problem Code1:
body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; }
Code2: ;(function(){ "use strict" window.addEventListener("load", setupAnimation, false); var gl, timer, rainingRect, scoreDisplay, missesDisplay; function setupAnimation (evt) { window.removeEventListener(evt.type, setupAnimation, false); if (!(gl = getRenderingContext())) return; gl.enable(gl.SCISSOR_TEST); rainingRect = new Rectangle(); timer = setTimeout(drawAnimation, 17); document.querySelector("canvas") .addEventListener("click", playerClick, false); var displays = document.querySelectorAll("strong"); scoreDisplay = displays[0]; missesDisplay = displays[1]; } var score = 0, misses = 0; function drawAnimation () { gl.scissor(rainingRect.position[0], rainingRect.position[1], rainingRect.size[0] , rainingRect.size[1]); gl.clear(gl.COLOR_BUFFER_BIT); rainingRect.position[1] -= rainingRect.velocity; if (rainingRect.position[1] = 0 && diffPos[0] = 0 && diffPos[1] This homework is to revise the WebGL demo which has rectangles falling down. The rules are as follows. When the user clicks inside a falling rectangle, the rectangle will pause on the canvas and change to a random color. When the user clicks inside a pausing rectangle again, the rectangle will fall down again with the original speed and change to another random color. This homework is to revise the WebGL demo which has rectangles falling down. The rules are as follows. When the user clicks inside a falling rectangle, the rectangle will pause on the canvas and change to a random color. When the user clicks inside a pausing rectangle again, the rectangle will fall down again with the original speed and change to another random color
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started