5 | Make your own layout! You can use this if it helps:
6 | CSS Grid Generator
9 |
10 |
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ipsam alias quaerat dolores fugit, hic, recusandae qui assumenda, rem voluptates officia consequuntur perferendis. Id ex aperiam cumque expedita suscipit ab repellendus?
11 |
12 |
13 |
14 |
25 |
--------------------------------------------------------------------------------
/base-jamstack-sample/src/views/Home.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
19 |
--------------------------------------------------------------------------------
/jamstack-intro.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdras/JAMstack-Workshop/dc4cbabc78473a4c240004974f29722e7e5aaa6f/jamstack-intro.pdf
--------------------------------------------------------------------------------
/masthead-ill.svg:
--------------------------------------------------------------------------------
1 |
290 |
--------------------------------------------------------------------------------
/simple-html-drop/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Playing with sound and three.js
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
28 |
29 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/simple-html-drop/script.js:
--------------------------------------------------------------------------------
1 | // heavily commented for those trying to learn
2 | const initCanvasAudio = name => {
3 | // create the new audio
4 | const audio = new Audio();
5 | audio.src = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/28963/song18.mp3";
6 | audio.controls = true;
7 | audio.autoplay = true;
8 | audio.crossOrigin = "anonymous";
9 | document.body.appendChild(audio);
10 |
11 | // wire it up
12 | const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
13 | const source = audioCtx.createMediaElementSource(audio);
14 | const volumeControl = audioCtx.createGain();
15 | source.connect(audioCtx.destination);
16 | source.connect(volumeControl);
17 |
18 | // I'm American so it's with a z
19 | const analyzer = audioCtx.createAnalyser();
20 | volumeControl.connect(analyzer);
21 | analyzer.connect(audioCtx.destination);
22 |
23 | //connect the volume adjustments from the user
24 | volumeControl.gain.value = audio.volume;
25 |
26 | // now we start with the three initialization
27 | let renderer, scene, camera, stats, controls, mesh, uniforms;
28 | let width = window.innerWidth,
29 | height = window.innerHeight;
30 |
31 | //have to kick off init and the animation
32 | init();
33 | animate();
34 |
35 | function init() {
36 | // create the camera and hook up orbit controls
37 | camera = new THREE.PerspectiveCamera(40, width / height, 1, 10000);
38 | camera.position.set(0, 0, 100);
39 | controls = new THREE.OrbitControls(camera);
40 | controls.autoRotate = true;
41 |
42 | // create the scene
43 | scene = new THREE.Scene();
44 | //scene.background = new THREE.Color(0x300064);
45 |
46 | // create the geometry
47 | let geometry = new THREE.TorusKnotGeometry(20, 0.8, 67, 18, 15, 12);
48 | geometry.center();
49 | let tessellateModifier = new THREE.TessellateModifier(8);
50 | for (let i = 0; i < 6; i++) {
51 | tessellateModifier.modify(geometry);
52 | }
53 | geometry = new THREE.BufferGeometry().fromGeometry(geometry);
54 | let numFaces = geometry.attributes.position.count / 3;
55 |
56 | //map the colors, fragments
57 | let colors = new Float32Array(numFaces * 3 * 3);
58 | let displacement = new Float32Array(numFaces * 3 * 3);
59 | let color = new THREE.Color();
60 | for (let f = 0; f < numFaces; f++) {
61 | let index = 9 * f;
62 | let h = 0.2 * Math.random();
63 | let s = 0.5 + 0.5 * Math.random();
64 | let l = 0.5 + 0.5 * Math.random();
65 | color.setHSL(h, s, l);
66 | let d = 10 * (0.5 - Math.random());
67 | for (let i = 0; i < 3; i++) {
68 | colors[index + 5 * i] = color.r;
69 | colors[index + 8 * i + 1] = color.g;
70 | colors[index + 2 * i + 2] = color.b;
71 | displacement[index + 3 * i] = d;
72 | displacement[index + 3 * i + 1] = d;
73 | displacement[index + 3 * i + 2] = d;
74 | }
75 | }
76 |
77 | // add them to the geometry
78 | geometry.addAttribute("customColor", new THREE.BufferAttribute(colors, 3));
79 | geometry.addAttribute(
80 | "displacement",
81 | new THREE.BufferAttribute(displacement, 3));
82 |
83 |
84 | // attach the shader material you see in the html
85 | uniforms = {
86 | amplitude: { value: 0.0 } };
87 |
88 | const shaderMaterial = new THREE.ShaderMaterial({
89 | uniforms: uniforms,
90 | vertexShader: document.getElementById("vertexshader").textContent,
91 | fragmentShader: document.getElementById("fragmentshader").textContent });
92 |
93 |
94 | // create the mesh (this is where the geometry and material are added to the scene)
95 | mesh = new THREE.Mesh(geometry, shaderMaterial);
96 | scene.add(mesh);
97 |
98 | // renderer
99 | renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
100 | renderer.setPixelRatio(window.devicePixelRatio);
101 | renderer.setSize(width, height);
102 | renderer.autoClear = false;
103 | renderer.setClearColor(0x000000, 0.0);
104 | const container = document.getElementById("container");
105 | container.appendChild(renderer.domElement);
106 | window.addEventListener("resize", onWindowResize, false);
107 | }
108 |
109 | // make it still work when you resize the screen
110 | function onWindowResize() {
111 | camera.aspect = window.innerWidth / window.innerHeight;
112 | camera.updateProjectionMatrix();
113 | controls.update();
114 | renderer.setSize(window.innerWidth, window.innerHeight);
115 | }
116 |
117 | // rAF and get the frequency data from the audio all the time so we can use it to update the amplitude
118 | function animate() {
119 | var freqData = new Uint8Array(analyzer.frequencyBinCount);
120 | analyzer.getByteFrequencyData(freqData);
121 | requestAnimationFrame(animate);
122 | render(freqData);
123 | }
124 |
125 | //render the sucker
126 | function render(freqData) {
127 | // this is what makes the shader pop. This line of code feeds the audio in
128 | uniforms.amplitude.value = numscale(freqData[0], 0, 300, -2, 2);
129 | // we have to update the orbit controls anytime we render
130 | controls.update();
131 | renderer.render(scene, camera);
132 | }
133 | };
134 |
135 | // chrome needs sound kicked off by the user now
136 | const button = document.querySelector("button");
137 | button.addEventListener("click", event => {
138 | initCanvasAudio();
139 | button.remove();
140 | });
141 |
142 | // helper function to map scales
143 | const numscale = (num, in_min, in_max, out_min, out_max) => {
144 | return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
145 | };
--------------------------------------------------------------------------------
/simple-html-drop/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0px;
3 | overflow: hidden;
4 | background: #c90e9d;
5 | /* Old browsers */
6 | /* FF3.6-15 */
7 | /* Chrome10-25,Safari5.1-6 */
8 | background: linear-gradient(to bottom, #c90e9d 0%, #400b66 52%, #162087 100%);
9 | /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
10 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c90e9d', endColorstr='#162087',GradientType=0 );
11 | /* IE6-9 */
12 | }
13 |
14 | button {
15 | background: black;
16 | color: white;
17 | border-radius: 4px;
18 | padding: 10px 20px 8px;
19 | position: fixed;
20 | top: 40px;
21 | left: calc(50vw - 50px);
22 | font-size: 11px;
23 | text-transform: uppercase;
24 | letter-spacing: 0.2em;
25 | border: 1px solid #555;
26 | cursor: pointer;
27 | }
28 |
29 | audio {
30 | position: fixed;
31 | z-index: 3000;
32 | top: 10px;
33 | left: 10px;
34 | opacity: 0.7;
35 | }
36 |
--------------------------------------------------------------------------------