Groups
Groups
Sign in
Groups
Groups
Paper.js
Conversations
About
Send feedback
Help
Add a method to Path.Circle objects
43 views
Skip to first unread message
Endash
unread,
Jan 27, 2012, 10:44:46 PM
1/27/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Paper.js
Hi,
I am using paperjs directly with javacript.
I can't find any documentation showing how to prototype a new method.
The code below returns an error: >>> pointer.display is not a
function
/*************************************************************/
window.onload = function(){
// Get a reference to the canvas object
var canvas = document.getElementById('myCanvas');
// Create an empty project and a view for the canvas:
paper.setup(canvas);
// Create the event handler
var tool = new paper.Tool();
// Create pointer
var pointer = new paper.Path.Circle(new paper.Point(-300, 0), 20);
// Set the display
pointer.display(5);
// Define display() method
PaperScope.Path.Circle.prototype.display = function(strokeWidth) {
this.strokeWidth = strokeWidth;
this.strokeColor = 'blue';
}
// Add listener
tool.onMouseMove = function(event) { pointer.position =
event.point; }
// Draw the view now:
paper.view.draw();
}
/*************************************************************/
Can anyone help me ?
Endash
unread,
Jan 27, 2012, 11:57:45 PM
1/27/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Paper.js
Problem solved:
http://groups.google.com/group/paperjs/browse_thread/thread/d7a4e80c9aae8a0f
Reply all
Reply to author
Forward
0 new messages