Comments (10)
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.
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.
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.
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.
It's strange that it call this.stroke() at last, which make current strokeStyle mess.
from p5.js-svg.
In latest p5.js:
from p5.js-svg.
However, we should check the behavior of Canvas, and throw a readable exception if try to set strange strokeStyle
from p5.js-svg.
from p5.js-svg.
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.
Should be fixed in zenozeng/svgcanvas@9a67300
from p5.js-svg.
Related Issues (20)
- Typescript type declarations HOT 4
- This library is great! HOT 1
- Scale the ABC svg
- Large exports fail on Firefox HOT 1
- use library within react, eg with react-p5 HOT 1
- Just a question: is the inverse possible?
- How to use in a Nuxt app? HOT 1
- Unwanted white background HOT 2
- Uncaught ReferenceError: module is not defined HOT 1
- Any way to create group inside svg HOT 6
- let pixelColor = get(x, y) breaks code
- mouseClicked() triggers only when clicking outsite the canvas HOT 1
- Error when using SVG renderer
- p5.js version 1.7.0 "reading '__clearCanvas'" error HOT 7
- Issue with P5Js 1.7.0
- Can i get some help trying to convert my sketch to a svg for the first time? HOT 1
- Incompatible with P5.js version 1.7.0 and 1.8.0 HOT 11
- Examples are broken HOT 1
- Can this be used only to save the image in svg but still render it with canvas HOT 1
- Feature request: XY pairs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p5.js-svg.