For my first digital arts assignment, I was to create a heart using all different sorts of codes. It is not the best heart, but for my first try with digital arts, it is not too bad. I am a little unsure of how to post the heart but I can give you the code that I used for it and you can check it out!
<!DOCTYPE HTML>
<html>
<head>
<script>
window.onload = function() {
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
////////////////////////////////////// start below this line ˇˇˇˇˇˇˇˇˇˇ
var startX = 400
var startY = 250
var cpointX = 200
var cpointY = 100
var endX = 150
var endY = 300
var startX = 400
var startY = 250
var cpointX = 600
var cpointY = 100
var endX = 650
var endY = 300
context.beginPath();
context.moveTo(400, 250);
context.quadraticCurveTo(200, 100, 150, 300);
context.lineWidth = 10;
context.strokeStyle = "red";
context.stroke();
context.beginPath();
context.moveTo(400, 250);
context.quadraticCurveTo(600, 100, 650, 300);
context.lineWidth = 10;
context.strokeStyle = "red";
context.stroke();
context.beginPath();
context.moveTo(150,300);
context.lineTo(400,600);
context.stroke();
context.beginPath();
context.moveTo(650,300);
context.lineTo(400,600);
context.stroke();
////////////////////////////////////// end above this line ˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆ
};
</script>
</head>
<body>
<canvas id="myCanvas" width="800" height="600"></canvas>
</body>
No comments:
Post a Comment