mirror of
https://github.com/seigler/generative
synced 2025-07-26 22:56:10 +00:00
publish: make room for future sketches
generated from commit 68a08e1763f1028c9229b91f7886406715c44475
This commit is contained in:
parent
f2393d2fe7
commit
4114418129
7 changed files with 41 additions and 20 deletions
15
1/index.html
Normal file
15
1/index.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Generative Art - seigler.github.io</title>
|
||||
<link rel="stylesheet" href="../app-c1dfc3c0.css">
|
||||
</head>
|
||||
<body>
|
||||
<script src="../modules/p5.min.js"></script>
|
||||
<script src="../modules/p5.sound.min.js"></script>
|
||||
<script src="../app-29573c47.js"></script>
|
||||
<footer><code>Space</code> or double click for a new one. <code>S</code> to save.</footer>
|
||||
</body>
|
||||
</html>
|
1
app-29573c47.js
Normal file
1
app-29573c47.js
Normal file
|
@ -0,0 +1 @@
|
|||
!function(){"use strict";var e="undefined"==typeof global?self:global;if("function"!=typeof e.require){var r={},o={},n={},t={}.hasOwnProperty,i=/^\.\.?(\/|$)/,a=function(e,r){for(var o,n=[],t=(i.test(r)?e+"/"+r:r).split("/"),a=0,s=t.length;a<s;a++)o=t[a],".."===o?n.pop():"."!==o&&""!==o&&n.push(o);return n.join("/")},s=function(e){return e.split("/").slice(0,-1).join("/")},d=function(r){return function(o){var n=a(s(r),o);return e.require(n,r)}},c=function(e,r){var n=p&&p.createHot(e),t={id:e,exports:{},hot:n};return o[e]=t,r(t.exports,d(e),t),t.exports},l=function(e){return n[e]?l(n[e]):e},u=function(e,r){return l(a(s(e),r))},f=function(e,n){null==n&&(n="/");var i=l(e);if(t.call(o,i))return o[i].exports;if(t.call(r,i))return c(i,r[i]);throw new Error("Cannot find module '"+e+"' from '"+n+"'")};f.alias=function(e,r){n[r]=e};var h=/\.[^.\/]+$/,v=/\/index(\.[^\/]+)?$/,m=function(e){if(h.test(e)){var r=e.replace(h,"");t.call(n,r)&&n[r].replace(h,"")!==r+"/index"||(n[r]=e)}if(v.test(e)){var o=e.replace(v,"");t.call(n,o)||(n[o]=e)}};f.register=f.define=function(e,n){if(e&&"object"==typeof e)for(var i in e)t.call(e,i)&&f.register(i,e[i]);else r[e]=n,delete o[e],m(e)},f.list=function(){var e=[];for(var o in r)t.call(r,o)&&e.push(o);return e};var p=e._hmr&&new e._hmr(u,f,r,o);f._cache=o,f.hmr=p&&p.wrap,f.brunch=!0,e.require=f}}(),function(){"undefined"==typeof window?this:window;require.register("initialize.js",function(e,r,o){"use strict";document.addEventListener("DOMContentLoaded",function(){r("sketches/1")})}),require.register("sketches/1.js",function(e,r,o){"use strict";new p5(function(e){function r(){if(n)e.randomSeed(n);else{var r=Math.floor(e.random(1e12));window.location.hash=r,e.randomSeed(r)}e.noiseSeed(e.random()),e.blendMode(e.BLEND),e.background("#000"),e.blendMode(e.ADD);for(var l=t*i/s,M=Math.sqrt(l),g=Math.max(1,Math.round(i/M))+1,b=Math.max(1,Math.round(t/M))+1,_=e.random(0,1e3*d),k=[],S=0;S<g*b;S++)k[S]=S;o(k);for(var x=0;x<g*b;x++){var q=k[x]%b,y=Math.floor(k[x]/b);u.noStroke(),u.background("#000");var E=e.noise(_+y/g*d,_+q/b*d),U=a*E,j=e.color(100*e.random(),100,90*E+10,70*E+10);u.fill(j),u.circle(a/2,a/2,U);for(var G=a/80,L=0;L<c;L++){var P=(c-L)*G/c;f.shader(m),m.setUniform("tex0",0==L?u:h),m.setUniform("texelSize",[P/a,P/a]),m.setUniform("direction",[1,0]),f.rect(0,0,a,a),h.shader(p),p.setUniform("tex0",f),p.setUniform("texelSize",[P/a,P/a]),p.setUniform("direction",[0,1]),h.rect(0,0,a,a)}if(u.image(h,0,0,a,a),e.random()>.5){u.fill("#000");var z=e.random(2*Math.PI),B=e.random(.1,1.5)*U/2,C=B*e.random(-.7,.3);u.circle((a+(C+U)*Math.cos(z))/2,(a+(C+U)*Math.sin(z))/2,2*B)}do{var W=e.random(2*Math.PI),D=e.random(2*Math.PI);u.stroke(0),u.strokeWeight(1+U*Math.pow(e.random(.7368),3)),u.line(a*(Math.sin(W)+.5),a*(Math.cos(W)+.5),a*(Math.sin(D)+.5),a*(Math.cos(D)+.5))}while(e.random()<.5+.45*E);var I=e.random(0,2*Math.PI),H=e.random(M),O=t/(b-1)*q+H*Math.cos(I),$=i/(g-1)*y+H*Math.sin(I);e.image(u,O-a/2,$-a/2)}v.shader(w),w.setUniform("u_resolution",[t,i]),w.setUniform("u_alpha",.05),v.rect(0,0,t,i),e.blendMode(e.OVERLAY),e.image(v,0,0)}function o(r){var o=0,n=0,t=null;for(o=r.length-1;o>0;o-=1)n=Math.floor(e.random()*(o+1)),t=r[o],r[o]=r[n],r[n]=t}e.disableFriendlyErrors=!0;var n=void 0,t=void 0,i=void 0,a=void 0,s=void 0,d=void 0,c=void 0,l=void 0,u=void 0,f=void 0,h=void 0,v=void 0,m=void 0,p=void 0,w=void 0;e.preload=function(){m=e.loadShader("../shaders/base.vert","../shaders/blur-two-pass.frag"),p=e.loadShader("../shaders/base.vert","../shaders/blur-two-pass.frag"),w=e.loadShader("../shaders/base.vert","../shaders/white-noise.frag")},e.setup=function(){d=2,c=2,s=70,window.onhashchange=function(){n=window.location.hash.substr(1),r()},n=window.location.hash.substr(1),e.noStroke(),e.colorMode(e.HSB,100),t=e.windowWidth,i=e.windowHeight,l=e.createCanvas(t,i),a=1.75*(t+i)/Math.sqrt(s),u=e.createGraphics(a,a),f=e.createGraphics(a,a,e.WEBGL),h=e.createGraphics(a,a,e.WEBGL),v=e.createGraphics(t,i,e.WEBGL),u.noStroke(),f.noStroke(),h.noStroke(),v.noStroke(),r()},e.draw=function(){},e.keyPressed=function(){" "==e.key?(n=null,r()):"s"==e.key&&e.saveCanvas("seigler-p5-1-gradient_burst-"+n+".jpg","jpg")},e.doubleClicked=function(){n=null,r()};var M=void 0;e.windowResized=function(){clearTimeout(M),M=setTimeout(function(){window.location.reload()},100)}})}),require.register("___globals___",function(e,r,o){})}(),require("___globals___"),require("initialize");
|
|
@ -1 +0,0 @@
|
|||
body,html{height:100%}body{background-color:#000;margin:0;padding:0;display:flex;align-items:center;justify-content:center}footer{position:fixed;bottom:0;left:0;max-width:100vw;color:#fff;background-color:#000;padding:.5em 1em;border-top-right-radius:.5em}
|
|
@ -1 +0,0 @@
|
|||
!function(){"use strict";var e="undefined"==typeof global?self:global;if("function"!=typeof e.require){var r={},o={},n={},t={}.hasOwnProperty,i=/^\.\.?(\/|$)/,a=function(e,r){for(var o,n=[],t=(i.test(r)?e+"/"+r:r).split("/"),a=0,s=t.length;a<s;a++)o=t[a],".."===o?n.pop():"."!==o&&""!==o&&n.push(o);return n.join("/")},s=function(e){return e.split("/").slice(0,-1).join("/")},d=function(r){return function(o){var n=a(s(r),o);return e.require(n,r)}},c=function(e,r){var n=p&&p.createHot(e),t={id:e,exports:{},hot:n};return o[e]=t,r(t.exports,d(e),t),t.exports},l=function(e){return n[e]?l(n[e]):e},u=function(e,r){return l(a(s(e),r))},f=function(e,n){null==n&&(n="/");var i=l(e);if(t.call(o,i))return o[i].exports;if(t.call(r,i))return c(i,r[i]);throw new Error("Cannot find module '"+e+"' from '"+n+"'")};f.alias=function(e,r){n[r]=e};var h=/\.[^.\/]+$/,v=/\/index(\.[^\/]+)?$/,m=function(e){if(h.test(e)){var r=e.replace(h,"");t.call(n,r)&&n[r].replace(h,"")!==r+"/index"||(n[r]=e)}if(v.test(e)){var o=e.replace(v,"");t.call(n,o)||(n[o]=e)}};f.register=f.define=function(e,n){if(e&&"object"==typeof e)for(var i in e)t.call(e,i)&&f.register(i,e[i]);else r[e]=n,delete o[e],m(e)},f.list=function(){var e=[];for(var o in r)t.call(r,o)&&e.push(o);return e};var p=e._hmr&&new e._hmr(u,f,r,o);f._cache=o,f.hmr=p&&p.wrap,f.brunch=!0,e.require=f}}(),function(){"undefined"==typeof window?this:window;require.register("initialize.js",function(e,r,o){"use strict";document.addEventListener("DOMContentLoaded",function(){r("sketches/1")})}),require.register("sketches/1.js",function(e,r,o){"use strict";new p5(function(e){function r(){if(n)e.randomSeed(n);else{var r=Math.floor(e.random(1e12));window.location.hash=r,e.randomSeed(r)}e.noiseSeed(e.random()),e.blendMode(e.BLEND),e.background("#000"),e.blendMode(e.ADD);for(var w=t*i/s,M=Math.sqrt(w),g=Math.max(1,Math.round(i/M))+1,b=Math.max(1,Math.round(t/M))+1,_=e.random(0,1e3*d),k=[],S=0;S<g*b;S++)k[S]=S;o(k);for(var x=0;x<g*b;x++){var q=k[x]%b,U=Math.floor(k[x]/b);l.noStroke(),l.background("#000");var y=e.noise(_+U/g*d,_+q/b*d),E=a*y,G=e.color(100*e.random(),100,90*y+10,70*y+10);l.fill(G),l.circle(a/2,a/2,E);for(var L=a/80,P=0;P<c;P++){var j=(c-P)*L/c;u.shader(v),v.setUniform("tex0",0==P?l:f),v.setUniform("texelSize",[j/a,j/a]),v.setUniform("direction",[1,0]),u.rect(0,0,a,a),f.shader(m),m.setUniform("tex0",u),m.setUniform("texelSize",[j/a,j/a]),m.setUniform("direction",[0,1]),f.rect(0,0,a,a)}if(l.image(f,0,0,a,a),e.random()>.5){l.fill("#000");var B=e.random(2*Math.PI),W=e.random(.1,1.5)*E/2,z=W*e.random(-.7,.3);l.circle((a+(z+E)*Math.cos(B))/2,(a+(z+E)*Math.sin(B))/2,2*W)}do{var C=e.random(2*Math.PI),D=e.random(2*Math.PI);l.stroke(0),l.strokeWeight(1+E*Math.pow(e.random(.7368),3)),l.line(a*(Math.sin(C)+.5),a*(Math.cos(C)+.5),a*(Math.sin(D)+.5),a*(Math.cos(D)+.5))}while(e.random()<.5+.45*y);var I=e.random(0,2*Math.PI),H=e.random(M),O=t/(b-1)*q+H*Math.cos(I),$=i/(g-1)*U+H*Math.sin(I);e.image(l,O-a/2,$-a/2)}h.shader(p),p.setUniform("u_resolution",[t,i]),p.setUniform("u_mean",.5),p.setUniform("u_variation",.5),h.rect(0,0,t,i),e.blendMode(e.OVERLAY),e.image(h,0,0)}function o(r){var o=0,n=0,t=null;for(o=r.length-1;o>0;o-=1)n=Math.floor(e.random()*(o+1)),t=r[o],r[o]=r[n],r[n]=t}e.disableFriendlyErrors=!0;var n=void 0,t=void 0,i=void 0,a=void 0,s=void 0,d=void 0,c=void 0,l=void 0,u=void 0,f=void 0,h=void 0,v=void 0,m=void 0,p=void 0;e.preload=function(){v=e.loadShader("shaders/base.vert","shaders/blur-two-pass.frag"),m=e.loadShader("shaders/base.vert","shaders/blur-two-pass.frag"),p=e.loadShader("shaders/base.vert","shaders/white-noise.frag")},e.setup=function(){d=2,c=2,s=70,window.onhashchange=function(){n=window.location.hash.substr(1),r()},n=window.location.hash.substr(1),e.noStroke(),e.colorMode(e.HSB,100),t=e.windowWidth,i=e.windowHeight,e.createCanvas(t,i),a=1.75*(t+i)/Math.sqrt(s),l=e.createGraphics(a,a),u=e.createGraphics(a,a,e.WEBGL),f=e.createGraphics(a,a,e.WEBGL),h=e.createGraphics(t,i,e.WEBGL),l.noStroke(),u.noStroke(),f.noStroke(),h.noStroke(),r()},e.draw=function(){},e.keyPressed=function(){" "==e.key&&(n=null,r())},e.doubleClicked=function(){n=null,r()}})}),require.register("___globals___",function(e,r,o){})}(),require("___globals___"),require("initialize");
|
1
app-c1dfc3c0.css
Normal file
1
app-c1dfc3c0.css
Normal file
|
@ -0,0 +1 @@
|
|||
*,:after,:before{box-sizing:inherit}body,html{height:100%;box-sizing:border-box}body{background-color:#000;margin:0;padding:0;display:flex;align-items:center;justify-content:center;color:#fff;font-family:sans-serif}main{text-align:left}a{color:inherit}a:focus,a:hover{color:#66f}code{display:inline-block;font-size:1.2em;line-height:1;padding:.5em .5em .2em;background-color:#222}footer{position:fixed;bottom:0;left:0;max-width:100vw;color:#fff;background-color:rgba(0,0,0,.8);padding:.5em 1em;border-top-right-radius:.5em}
|
12
index.html
12
index.html
|
@ -4,12 +4,14 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Generative Art - seigler.github.io</title>
|
||||
<link rel="stylesheet" href="app-75d0b445.css">
|
||||
<link rel="stylesheet" href="app-c1dfc3c0.css">
|
||||
</head>
|
||||
<body>
|
||||
<footer>Press space or double click for a new one</footer>
|
||||
<script src="modules/p5.min.js"></script>
|
||||
<script src="modules/p5.sound.min.js"></script>
|
||||
<script src="app-8f881de3.js"></script>
|
||||
<main>
|
||||
<h1>P5.js generative art</h1>
|
||||
<ol>
|
||||
<li><a class="sketch" href="1/">gradient burst</a></li>
|
||||
</ol>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
precision mediump float;
|
||||
|
||||
uniform vec2 u_resolution;
|
||||
uniform float u_alpha;
|
||||
|
||||
float random (vec2 st) {
|
||||
return fract(sin(dot(st.xy,
|
||||
vec2(12.9898,78.233)))*
|
||||
43758.5453123);
|
||||
highp float random(vec2 co) {
|
||||
highp float a = 12.9898;
|
||||
highp float b = 78.233;
|
||||
highp float c = 43758.5453;
|
||||
highp float dt= dot(co.xy, vec2(a, b));
|
||||
highp float sn= mod(dt, 3.14);
|
||||
return fract(sin(sn) * c);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 st = gl_FragCoord.xy/u_resolution.xy;
|
||||
|
||||
float rnd = random( st );
|
||||
float rnd = random(st);
|
||||
|
||||
gl_FragColor = vec4(vec3(rnd),0.05);
|
||||
gl_FragColor = vec4(vec3(rnd), u_alpha);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue