xxxxxxxxxx
let lines
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL)
pixelDensity(1)
lines = createFilterShader(`#version 300 es
precision highp float;
uniform sampler2D tex0;
uniform vec2 canvasSize;
in vec2 vTexCoord;
out vec4 outColor;
void main() {
float a = texture(tex0, vTexCoord).x;
float w = 10.;
float x = fract(vTexCoord.x * canvasSize.x / w);
float t = max(a - 0.01, 0.) * 0.25 + 0.2;
float outA = smoothstep(0.4-t, 0.5-t, x) * (1. - smoothstep(0.5+t, 0.5+t, x));
outColor = mix(
vec4(252., 3., 111., 255.)/255.,
vec4(1.),
outA
);
}
`)
}
function draw() {
background(255)
push()
noStroke()
lights()
fill(100)
specularMaterial(255)
shininess(200)
rotateX(millis() * 0.0005);
rotateY(millis() * 0.0005);
scale(min(width, height) / 150);
torus(30, 10, 50, 30);
pop()
filter(BLUR, 3)
filter(lines)
}