~jagtalon/long-exposure-art

6fa949b767d5a64cd844a552408540480b69e3cc — Jag Talon 1 year, 10 months ago 2825bf1
Adjust gradient
2 files changed, 8 insertions(+), 10 deletions(-)

M long-exposure-art.coffee
M long-exposure-art.js
M long-exposure-art.coffee => long-exposure-art.coffee +4 -5
@@ 18,11 18,10 @@ sketch = ->
		# 1. For each radius, create an arc with an angle theta.
		# 2. Rotate the arc to a random angle (Math.random() * 2π)
		drawStarTrails = (radius, theta) ->
			console.log radius
			color = random.pick(["#fdfffc", "#819EC9", "#ACE4FF"])

			# Add a gradient to make the stars fade out a little.
			gradient = context.createLinearGradient(0, 0, width/2, height/2)
			gradient = context.createLinearGradient(0, 0, width * 0.5, height * .5)
			gradient.addColorStop(0, color)
			gradient.addColorStop(1, "transparent")



@@ 37,16 36,16 @@ sketch = ->
		draw.rect 0, 0, width, height, "fill", "#011627"

		# Set the coordinates of the rotation.
		draw.translate width * 0.1, height * 0.2
		draw.translate width * 0.2, height * 0.15
		
		# Set an angle that will be used everywhere.
		# This can be any arbitrary angle, but it
		# must be the same for all star trails.
		theta = Math.PI * .1
		theta = Math.PI/6

		# Generate radii
		# We generate random radii then create star trails for each one.
		drawStarTrails(Math.random() * height, theta) for n in [1..15000]
		drawStarTrails(Math.random() * height, theta) for n in [1..9000]


canvasSketch sketch, settings
\ No newline at end of file

M long-exposure-art.js => long-exposure-art.js +4 -5
@@ 25,10 25,9 @@
      // 2. Rotate the arc to a random angle (Math.random() * 2π)
      drawStarTrails = function(radius, theta) {
        var color, gradient;
        console.log(radius);
        color = random.pick(["#fdfffc", "#819EC9", "#ACE4FF"]);
        // Add a gradient to make the stars fade out a little.
        gradient = context.createLinearGradient(0, 0, width / 2, height / 2);
        gradient = context.createLinearGradient(0, 0, width * 0.5, height * .5);
        gradient.addColorStop(0, color);
        gradient.addColorStop(1, "transparent");
        draw.circle(0, 0, radius, 0, theta);


@@ 41,14 40,14 @@
      // Set the night sky.
      draw.rect(0, 0, width, height, "fill", "#011627");
      // Set the coordinates of the rotation.
      draw.translate(width * 0.1, height * 0.2);
      draw.translate(width * 0.2, height * 0.15);
      
      // Set an angle that will be used everywhere.
      // This can be any arbitrary angle, but it
      // must be the same for all star trails.
      theta = Math.PI * .1;
      theta = Math.PI / 6;
      results = [];
      for (n = i = 1; i <= 15000; n = ++i) {
      for (n = i = 1; i <= 9000; n = ++i) {
        // Generate radii
        // We generate random radii then create star trails for each one.
        results.push(drawStarTrails(Math.random() * height, theta));