Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>All you have to do is create one or more radial gradients to fit the properties of the glassy object that you want. It's easy to do!</p> <p>Just one gradient:</p> <pre><code>// Create some gradient var gradient = ctx.createRadialGradient(105, 105, 20, 120, 120, 50); gradient.addColorStop(0, 'rgba(250,250,255,0)'); gradient.addColorStop(0.75, 'rgba(230,250,255,1.0)'); gradient.addColorStop(1, 'rgba(0,0,255,0)'); // draw the gradient (note that we dont bother drawing a circle, this is more efficient and less work!) // but make sure it covers the entire gradient ctx.fillStyle = gradient; ctx.fillRect(0, 0, 300, 300);​ </code></pre> <p>Can make this:</p> <p><img src="https://i.stack.imgur.com/4uzKp.png" alt="enter image description here"></p> <p>Live example:</p> <p><a href="http://jsfiddle.net/GTbjk/" rel="noreferrer">http://jsfiddle.net/GTbjk/</a></p> <p>Maybe you want to reign in that fuzzy edge:</p> <pre><code>gradient.addColorStop(0.8, 'rgba(0,0,255,0)'); gradient.addColorStop(1, 'rgba(0,0,255,0)'); </code></pre> <p><a href="http://jsfiddle.net/GTbjk/1/" rel="noreferrer">http://jsfiddle.net/GTbjk/1/</a></p> <p>I'm not going to make one to your specification, since you didn't provide one and thats not what we're here for anyway. Making these will almost exclusively be the work of well-placed radial gradients, so go experiment!</p> <p>As j08691 points out this is a really inefficent way of making these unless you want them to be dynamic or scalable, you are better off just making images and use <code>ctx.drawImage</code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload