Quadratic bezier curves for Processing.js

Since Processing and respectively Processing.js don’t support quadratic curves, you are forced to construct them with a conventional cubic bezier curve. I’ve never used bezier curves before, so I took this as a lesson.

I came up at least with an implementation for quadraticBezierVertex(cpx, cpy, x, y), which you can use to create shapes.

You can put this code into a .lib file and import() it into your sketch to add support for quadratic curves to Processing.js.

The actual reason I created this was the need for flexible rounded rectangles, which don’t look smart unless you use quadratic curves for the corners. Because it’s a shape based on a path you can modify fill and stroke as usual.

Finally here’s the result. I’m using a stroke weight of 2 pixels and a 10 pixel radius for the rounded corners.

36 Responses to “Quadratic bezier curves for Processing.js”

  1. Patrick says:

    Trying to do this in regular processing, but I can’t figure out what prevX and prevY are supposed to be.

  2. Michael says:

    Such internals as prevX/prevY might be hidden in native Processing as they’re just relevant to vertex based shapes. You might want to set them manually in the meanwhile.

  3. BILL says:


    PillSpot.org. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.Best quality drugs. High quality pills. Order drugs online

    Buy:Advair.Benicar.Zetia.Aricept.Nymphomax.Lipothin.Lipitor.Seroquel.SleepWell.Lasix.Amoxicillin.Female Pink Viagra.Prozac.Female Cialis.Ventolin.Wellbutrin SR.Buspar.Acomplia.Cozaar.Zocor….

  4. ALFREDO says:


    MedicamentSpot.com. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. Low price drugs. Buy pills online

    Buy:Propecia.Levitra.VPXL.Soma.Zithromax.Super Active ED Pack.Cialis Professional.Viagra Super Force.Viagra Soft Tabs.Tramadol.Cialis.Viagra Super Active+.Viagra.Cialis Super Active+.Viagra Professional.Cialis Soft Tabs.Maxaman….

  5. ALFRED says:


    CheapTabletsOnline.com. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. Low price drugs. Order pills online

    Buy:Nexium.Human Growth Hormone.Prednisolone.Retin-A.Petcam (Metacam) Oral Suspension.100% Pure Okinawan Coral Calcium.Mega Hoodia.Lumigan.Actos.Valtrex.Zovirax.Zyban.Prevacid.Accutane.Synthroid.Arimidex….

  6. LUIS says:


    NEW FASHION store. Original designers collection at low prices!!! 20 % TO 70 % OFF. END OF SEASON SALE!!!

    BUY FASHION. TOP BRANDS: GUCCI, DOLCE&GABBANA, BURBERRY, DIESEL, ICEBERG, ROBERTO CAVALLI, EMPORIO ARMANI, VERSACE…

  7. TODD says:

    buy pure acai berry

    Buyno prescription…

  8. FERNANDO says:

    Amoxicillin@official.site” rel=”nofollow”>…

    Buyno prescription…

  9. GREGORY says:

    Azor@official.site” rel=”nofollow”>…

    Buygeneric pills…

  10. RAYMOND says:

    Cozaar@official.site” rel=”nofollow”>..

    Buynow it…

  11. ALBERTO says:

    Crestor@official.site” rel=”nofollow”>.

    Buywithout prescription…

  12. DARRELL says:

    generic@viagra.sildenafil.paypal.no.prescription” rel=”nofollow”>…

    Buygeneric meds…

  13. GUY says:

    abilify@and.sleep.issues” rel=”nofollow”>.

    Buyno prescription…

  14. JON says:

    < a href=”http://my.gardenguides.com/members/buy-Tramadol? buy@tramadol.best.price.online

    Buyit now…

  15. JESSE says:

    is@sun.pharmaceuticals.depakote.good.quality” rel=”nofollow”>.

    Buyno prescription…

  16. TRACY says:

    side@effects.of.zyrtec.overdose” rel=”nofollow”>.

    Buygeneric meds…

  17. KEITH says:

    Voltaren

    Buygeneric drugs…

  18. TROY says:

    Loratadine

    Buyno prescription…

  19. SAM says:

    Yaz

    Buywithout prescription…

  20. EDWARD says:

    Yaz

    Buywithout prescription…

  21. RUSSELL says:

    Zofran

    Buygeneric pills…

  22. RONNIE says:

    leg swelling lasix

    Buyno prescription…

  23. DONNIE says:

    yaz plan b

    Buydrugs without prescription…

  24. AUSTIN says:

    risperdal and luvox loss of libido

    Buydrugs without prescription…

  25. HUBERT says:

    Prozac

    Buyno prescription…

  26. CLINTON says:

    Purim

    Buyit now…

  27. CHRIS says:

    Rogaine

    Buygeneric meds…

  28. CURTIS says:

    Zoloft

    Buynow it…

  29. FREDDIE says:

    Symbicort@Symbicort.Symbicort” rel=”nofollow”>…

    Buynow it…


Dudes

Projects