how to draw a ellipse in paper.js

558 views
Skip to first unread message

philip wasserman

unread,
Mar 3, 2013, 6:05:59 PM3/3/13
to pap...@googlegroups.com
Hi
 
I don't see a way on how to drawing an ellipse with paper.js,
 
Does anyone have a sample on how to draw a ellipse when using 
     Center point,  Major Axis,  Minor Axis, Radius Ratio with paper.js
                      
Canvas example:
 
var ctx = document.getElementById('canvas1').getContext('2d') ;
  
// Ellipse
var startAngleinDegrees = 0 ;
var endAngleinDegrees = 360 ;
  
var startAngleinRadians = (Math.PI/180) * startAngleinDegrees ;
var endAngleinRadians = (Math.PI/180) * endAngleinDegrees ;
  
ctx.beginPath() ;
ctx.ellipse(200, 250, 50, 50, 0, startAngleinRadians, endAngleinRadians, false) ;
ctx.closePath() ;
ctx.stroke() ;
 
 

Zack Grossbart

unread,
Mar 3, 2013, 6:15:37 PM3/3/13
to pap...@googlegroups.com
Take a look at Path.Oval:


That should do what you're looking for.

Cheers,
Zack

philip wasserman

unread,
Mar 3, 2013, 8:08:35 PM3/3/13
to pap...@googlegroups.com
Hi
 Thanks I'll give it a try.
 
I was looking for something like this to draw Ellipse and Ellipse Arc's

Kamal Reddy

unread,
Mar 4, 2013, 2:36:22 AM3/4/13
to pap...@googlegroups.com
you can create a circle and then scale it using .scale(x,y) method.
That should do it.

Jürg Lehni

unread,
Mar 5, 2013, 7:22:34 PM3/5/13
to pap...@googlegroups.com
In the nightly builds it's now called Path.Ellipse

There's also this:

http://paperjs.org/reference/path#path-arc-from-through-to

And this:

http://paperjs.org/reference/path#arcto-through-to

J
> --
> You received this message because you are subscribed to the Google Groups "Paper.js" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to paperjs+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Reply all
Reply to author
Forward
0 new messages