Giter Site home page Giter Site logo

Comments (10)

zenozeng avatar zenozeng commented on July 26, 2024
                noFill();
                bezier(85, 20, 10, 10, 90, 90, 15, 80);
                fill(255);
                steps = 10;
                for (var i = 0; i <= steps; i++) {
                    var t = i / steps;
                    x = bezierPoint(85, 10, 90, 15, t);
                    y = bezierPoint(20, 10, 90, 80, t);
                    stroke(100); // this line fix it!
                    ellipse(x, y, 5, 5);
                }

from p5.js-svg.

zenozeng avatar zenozeng commented on July 26, 2024

Seems that in __applyStyleToCurrentElement, it tries to set strokeStyle to rgba(NaN,NaN,NaN,1),
So, the following code fails:

regex = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi;
matches = regex.exec(value);
this.__currentElement.setAttribute(style.svgAttr, format('rgb({r},{g},{b})', {
    r: matches[1],
    g: matches[2],
    b: matches[3]
}));

from p5.js-svg.

zenozeng avatar zenozeng commented on July 26, 2024
  p5.prototype.stroke = function() {
    this._setProperty('_doStroke', true);
    var ctx = this.drawingContext;
    var color = this.color.apply(this, arguments);
    ctx.strokeStyle = color.toString();
  };
``

from p5.js-svg.

zenozeng avatar zenozeng commented on July 26, 2024
  p5.prototype.curve = function(x1, y1, x2, y2, x3, y3, x4, y4) {
    if (!this._doStroke) {
      return;
    }
    this.beginShape();
    this.curveVertex(x1, y1);
    this.curveVertex(x2, y2);
    this.curveVertex(x3, y3);
    this.curveVertex(x4, y4);
    this.endShape();
    this.stroke(); // note this line
    return this;
  };

from p5.js-svg.

zenozeng avatar zenozeng commented on July 26, 2024

It's strange that it call this.stroke() at last, which make current strokeStyle mess.

from p5.js-svg.

zenozeng avatar zenozeng commented on July 26, 2024

In latest p5.js:

2015-05-31 13 10 15

from p5.js-svg.

zenozeng avatar zenozeng commented on July 26, 2024

However, we should check the behavior of Canvas, and throw a readable exception if try to set strange strokeStyle

from p5.js-svg.

zenozeng avatar zenozeng commented on July 26, 2024

zenozeng/svgcanvas@2c63508

from p5.js-svg.

zenozeng avatar zenozeng commented on July 26, 2024

Still having the same bug in 0.4.5, maybe waiting for 0.4.6, there are a lot of commits since 0.4.5.

from p5.js-svg.

zenozeng avatar zenozeng commented on July 26, 2024

Should be fixed in zenozeng/svgcanvas@9a67300

from p5.js-svg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.