<!-- w w w. j a v a 2s . c o m-->
<html>
<head>
<script>
function drawSpade(context, x, y, width, height){
context.save();
var bottomWidth = width * 0.7;
var topHeight = height * 0.7;
var bottomHeight = height * 0.3;
context.beginPath();
context.moveTo(x, y);
// top left of spade
context.bezierCurveTo(
x, y + topHeight / 2, // control point 1
x - width / 2, y + topHeight / 2, // control point 2
x - width / 2, y + topHeight // end point
);
// bottom left of spade
context.bezierCurveTo(
x - width / 2, y + topHeight * 1.3, // control point 1
x, y + topHeight * 1.3, // control point 2
x, y + topHeight // end point
);
// bottom right of spade
context.bezierCurveTo(
x, y + topHeight * 1.3, // control point 1
x + width / 2, y + topHeight * 1.3, // control point 2
x + width / 2, y + topHeight // end point
);
// top right of spade
context.bezierCurveTo(
x + width / 2, y + topHeight / 2, // control point 1
x, y + topHeight / 2, // control point 2
x, y // end point
);
context.closePath();
context.fill();
// bottom of spade
context.beginPath();
context.moveTo(x, y + topHeight);
context.quadraticCurveTo(
x, y + topHeight + bottomHeight, // control point
x - bottomWidth / 2, y + topHeight + bottomHeight // end point
);
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.