0

i have drawn over a ribbon with the code:

var canvas = document.getElementById('draw-ribbon'); ctx = canvas.getContext("2d"); ctx.fillStyle = 'red'; ctx.beginPath(); ctx.moveTo(0, 0); ctx.lineTo(300, 0); ctx.lineTo(260, 75); ctx.lineTo(300, 150); ctx.lineTo(0, 150); ctx.closePath(); ctx.fill(); 

got this:

enter image description here

after this i have tried filltext() but didn't work i want to achieve this:

enter image description here

1

1 Answer 1

1

May be not working because the text color is also red

var canvas = document.getElementById('myCanvas'); ctx = canvas.getContext("2d"); ctx.fillStyle = 'red'; ctx.beginPath(); ctx.moveTo(0, 0); ctx.lineTo(300, 0); ctx.lineTo(260, 75); ctx.lineTo(300, 150); ctx.lineTo(0, 150); ctx.closePath(); ctx.fill(); ctx.font="30px Verdana"; ctx.fillStyle = 'white'; ctx.fillText("Text",50,80); 

http://jsfiddle.net/dvdyakonov/zFg5q/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.