Reputation: 1364
I am using following code to convert kinetic textPath to image
var simpleText = new Kinetic.TextPath({
x: 400,
y: 0,
fill: '#333',
fontSize: '24',
fontFamily: 'Arial',
text: 'Lorem Ipsum Lorem Ipsum ',
data: 'M70,70 A50,50 0 1,1 69,70'
});
var textImgSrc = simpleText.toDataURL(); // base64 image of text
var textImgObj = new Image();
textImgObj.src = textImgSrc;
console.log(textImgObj.src);
but in console it gives me no image else "data:,"
Upvotes: 0
Views: 38
Reputation: 20288
You have to set position and size properties for your TextPath
:
var textImgSrc = simpleText.toDataURL({
x : 0,
y : 50,
width : 130,
height : 130
}); // base64 image of text
http://jsbin.com/newuro/1/edit?html,js,output
Upvotes: 1