Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37526
| From | Alan <araskin@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Problem drawing lines on a canvas element |
| Date | 2019-10-11 22:44 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <qnrejc$8o4$1@dont-email.me> (permalink) |
| References | <8c504426-06b7-4f57-babf-7c2d64aaace5@googlegroups.com> <qnje3h$r8e$1@dont-email.me> <cee794bf-a21b-457c-8926-ebb16641c040@googlegroups.com> <d9d6a215-a01e-465e-bac9-b1ccbebb5029@googlegroups.com> |
On 11/10/2019 6:41 p.m., dr.j.r.stockton@gmail.com wrote:
> On Wednesday, 9 October 2019 10:26:02 UTC+1, dr.j.r...@gmail.com wrote:
>> On Wednesday, 9 October 2019 02:45:28 UTC+1, Alan wrote:
>>> Your
>>>
>>> CX.beginPath()
>>>
>>> in the
>>>
>>> if (Main) {}
>>>
>>> block should be inside the for loop instead of before it.
>>
>> Yes - thanks.
>>
>> I'll look for an analogous situation for my maybe-related other problem.
>
> The situation seems to be with the following, in which the loop builds a path
> which is essentially a not-necessarily-closed irregular polygon, and I want the next statement to draw the path in the colour "Hue". What seems to be happening is that, when Sinuous is called several times in succession with varying Hue, the colours are applied to incorrect sinuosities.
>
> If there is an obvious error and fix, I'll apply them; otherwise, more testing is needed.
>
> function Sinuous(Hue /* ,[,],[,] ... */) { // Stroke a sequence -
> // undefined array element means "as before", 0/1 means off/on
> var J, K, L = arguments.length, Line = false, X, Y
> CX.save()
> CX.strokeStyle = Hue
> CX.beginPath()
> for (J = 1 ; J < L ; J++) { K = arguments[J] // alert(K)
> if (isFinite(K[0])) X = K[0] ; if (isFinite(K[1])) Y = K[1]
> if (isNaN(X) || isNaN(Y)) alert("Sinuous: bad argument #" + (J+1))
> if (K != 0) Line ? CX.lineTo(X*w, Y*h) : CX.moveTo(X*w, Y*h)
> Line = K != 0 }
> CX.stroke()
> CX.restore() } // end Sinuous
>
>
Your code seems to work fine for me. Please provide the actual,
problematic Sinuous() calls you are using.
(I only read newsgroups once in the evening, so feel free to continue
this discussion via email for a more prompt response.)
- Alan
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Problem drawing lines on a canvas element Alan <araskin@gmail.com> - 2019-10-08 21:46 -0400
Re: Problem drawing lines on a canvas element dr.j.r.stockton@gmail.com - 2019-10-09 02:25 -0700
Re: Problem drawing lines on a canvas element dr.j.r.stockton@gmail.com - 2019-10-11 15:41 -0700
Re: Problem drawing lines on a canvas element Alan <araskin@gmail.com> - 2019-10-11 22:44 -0400
Re: Problem drawing lines on a canvas element dr.j.r.stockton@gmail.com - 2019-10-12 15:50 -0700
Re: Problem drawing lines on a canvas element "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-12 20:36 -0700
Re: Problem drawing lines on a canvas element luserdroog <luser.droog@gmail.com> - 2019-10-12 22:14 -0700
csiph-web