Ich versuche, einige Änderungen (in ES6) in diesem Stift http://codepen.io/IMarty/pen/RaajQx zu tun, und es ist fast perfekt funktionierende, außer für diese FunktionES6 - Leinwand-Hub nicht funktioniert
function drawLines(p) {
if(!p.active) return;
for(var i in p.closest) {
ctx.beginPath();
ctx.moveTo(p.x, p.y);
ctx.lineTo(p.closest[i].x, p.closest[i].y);
ctx.strokeStyle = 'rgba(255,255,255,'+ p.active+')';
ctx.stroke();
}
}
In meiner Feder http://codepen.io/wendelnascimento/pen/PzRzGE, i‘ Ich habe alles in ES6 geschrieben und es funktioniert, aber nur die Striche werden nicht angezeigt. Die Methode sieht so aus:
drawLines(p) {
if(!p.active)
return;
for(var i = 0; i < p.closest.length; i++) {
this._context.beginPath();
this._context.moveTo(p.x, p.y);
this._context.lineTo(p.closest[i].x, p.closest[i].y);
this._context.strokeStyle = `rgba(255,255,255,${p.active})`;
this._context.stroke();
}
}
Kann mir jemand dabei helfen?
Danke! Ich musste diesen Code auch hinzufügen, um das gewünschte Verhalten zu erreichen: let c = neuer Kreis (this._points [i], 2 + Math.random() * 5, 'rgba (255,255,255,0.3)'); für (let k = 0; k <5; k ++) { if (! Plaziert) { if (c.getDistanz (p1, p2)