float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
return mix(rand(fl), rand(fl + 1.0), fc);
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| max_ramp_value = op('select1')[0] | |
| pulse_count = 0 | |
| def onStart(me): | |
| global pulse_count | |
| pulse_count = 0 | |
| return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from html.parser import HTMLParser | |
| class ImageParser(HTMLParser): | |
| def __init__(self): | |
| super().__init__() | |
| self.image_rows = [] # list of [url, caption] | |
| self.current_img = None | |
| self.in_caption_div = False | |
| self.in_caption_p = False | |
| self.current_caption = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # me - this DAT. | |
| # webClientDAT - The connected Web Client DAT | |
| # statusCode - The status code of the response, formatted as a dictionary with two key-value pairs: 'code', 'message'. | |
| # headerDict - The header of the response from the server formatted as a dictionary. Only sent once when streaming. | |
| # data - The data of the response | |
| # id - The request's unique identifier | |
| def onConnect(webClientDAT, id): | |
| return | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const WaveShaderMaterial = shaderMaterial( | |
| // uniforms | |
| { uTime: 0, uTexture: new THREE.Texture() }, | |
| // vertex | |
| glsl' | |
| varying vec2 vUv; | |
| void main() { | |
| vUv = uv; | |
| gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| layout: { | |
| query: "page.layout.toLayouts", | |
| select: { | |
| columns: { | |
| query: "layout.columns", | |
| select: { | |
| blocks: { | |
| select: { | |
| content: { | |
| select: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function useKeyPress(targetKey) { | |
| // State for keeping track of whether key is pressed | |
| const [keyPressed, setKeyPressed] = useState<boolean>(false); | |
| // If pressed key is our target key then set to true | |
| function downHandler({ key }) { | |
| if (key === targetKey) { | |
| setKeyPressed(true); | |
| } | |
| } | |
| // If released key is our target key then set to false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useState, useEffect } from "react"; | |
| export default function useWindowDimensions() { | |
| const hasWindow = typeof window !== "undefined"; | |
| function getWindowDimensions() { | |
| const width = hasWindow ? window.innerWidth : null; | |
| const height = hasWindow ? window.innerHeight : null; | |
| return { | |
| width, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| To use it, simply declare: | |
| `const post = new PostFX(rendering);` | |
| Then on update, instead of: | |
| `rendering.render(scene, camera);` | |
| replace with: | |
| `post.render(scene, camera);` | |
| */ | |
| import { |