This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 12524 - It would be nice if you could see the pretty glowing lines
Summary: It would be nice if you could see the pretty glowing lines
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML Canvas 2D Context (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-19 23:11 UTC by contributor
Modified: 2011-08-04 05:03 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2011-04-19 23:11:53 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
Section: http://www.whatwg.org/specs/web-apps/current-work/complete.html#examples

Comment:
It would be nice if you could see the pretty glowing lines

Posted from: 67.180.99.41
User agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27
Comment 1 Ian 'Hixie' Hickson 2011-05-04 18:27:49 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Who can argue with that.
Comment 2 contributor 2011-05-04 18:28:02 UTC
Checked in as WHATWG revision r6062.
Check-in comment: by request
http://html5.org/tools/web-apps-tracker?from=6061&to=6062
Comment 3 Aryeh Gregor 2011-05-04 23:15:01 UTC
Why is it base64-encoded in the source?  That makes me sad.
Comment 4 Ian 'Hixie' Hickson 2011-05-04 23:34:21 UTC
What would make you happy?
Comment 5 Aryeh Gregor 2011-05-05 22:56:30 UTC
Not base64-encoding it, so it's readable in the source.  base64 data URLs are only really needed for binary formats, not HTML.  So just do something like

<a href="data:text/html,<!DOCTYPE HTML>
<html lang=en>
 <head>
  <title>Pretty Glowing Lines</title>
 </head>
 <body>
<canvas width=800 height=450></canvas>
<script>

 var context = document.getElementsByTagName('canvas')[0].getContext('2d');

 var lastX = context.canvas.width * Math.random();
 var lastY = context.canvas.height * Math.random();
 var hue = 0;
 function line() {
   context.save();
   context.translate(context.canvas.width/2, context.canvas.height/2);
   context.scale(0.9, 0.9);
   context.translate(-context.canvas.width/2, -context.canvas.height/2);
   context.beginPath();
   context.lineWidth = 5 + Math.random() * 10;
   context.moveTo(lastX, lastY);
   lastX = context.canvas.width * Math.random();
   lastY = context.canvas.height * Math.random();
   context.bezierCurveTo(context.canvas.width * Math.random(),
                         context.canvas.height * Math.random(),
                         context.canvas.width * Math.random(),
                         context.canvas.height * Math.random(),
                         lastX, lastY);

   hue = hue + 10 * Math.random();
   context.strokeStyle = 'hsl(' + hue + ', 50%, 50%)';
   context.shadowColor = 'white';
   context.shadowBlur = 10;
   context.stroke();
   context.restore();
 }
 setInterval(line, 50);

 function blank() {
   context.fillStyle = 'rgba(0,0,0,0.1)';
   context.fillRect(0, 0, context.canvas.width, context.canvas.height);
 }
 setInterval(blank, 40);

</script>
 </body>
</html>">pretty glowing lines</a>

Or is that invalid for some reason?  I don't see why it should be.  It works fine in browsers.
Comment 6 Simon Pieters 2011-05-05 23:10:22 UTC
Pretty sure that's not a valid URL (for one it has spaces in it). V.nu says

Error: Bad value data:text/html,<!DOCTYPE HTML>... for attribute href on element a: Illegal character in path component.
Comment 7 Aryeh Gregor 2011-05-06 16:03:46 UTC
Why should it not be a valid URL, if it works in all browsers (assuming they support data URLs at all in this situation)?
Comment 8 Ian 'Hixie' Hickson 2011-05-06 20:18:40 UTC
The script is _right there_ in the spec already.
Comment 9 Aryeh Gregor 2011-05-06 20:42:35 UTC
Um.  Well, okay, that's true.
Comment 10 Michael[tm] Smith 2011-08-04 05:03:46 UTC
mass-move component to LC1