Last active
December 17, 2018 18:25
-
-
Save vincentntang/4ec6d8cead6db714a38733aff76df978 to your computer and use it in GitHub Desktop.
Part 1 of canvas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var canvas = document.querySelector("canvas"); | |
canvas.width = window.innerWidth; | |
canvas.height = window.innerHeight; | |
canvas.width = 1600; | |
canvas.height = 800; | |
var ctx = canvas.getContext("2d"); | |
// Vanishing point 0 | |
var x0 = 400; | |
var y0 = 400; | |
// Vanishing point end 0a | |
var x0a = 0; | |
var y0a = 2 * y0; | |
// Vanishing point end 0b | |
var x0b = 2 * x0; | |
var y0b = 2 * y0; | |
// Define delta | |
var delta = 700; | |
// First Line | |
ctx.beginPath(); | |
ctx.moveTo(x0, y0); | |
ctx.lineTo(x0a, y0a); | |
ctx.strokeStyle = 'red'; | |
ctx.stroke(); | |
// Second Line | |
ctx.beginPath(); | |
ctx.moveTo(x0, y0); | |
ctx.lineTo(x0b, x0b); | |
ctx.strokeStyle = 'green'; | |
ctx.stroke(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment