“Genuary 21: Tapeworms (Mashup)” by Dave Pagurek
https://openprocessing.org/sketch/1443239
License CreativeCommons Attribution NonCommercial ShareAlike
https://creativecommons.org/licenses/by-nc-sa/3.0
{{filePath}}
{{width}} x {{height}}
Report Sketch
Oh, that naughty sketch! Please let us know what the issue is below.
Apply Template
Applying this template will reset your sketch and remove all your changes. Are you sure you would like to continue?
Report Sketch
Report Comment
Please confirm that you would like to report the comment below.
We will review your submission and take any actions necessary per our Community Guidelines. In addition to reporting this comment, you can also block the user to prevent any future interactions.
Please report comments only when necessary. Unnecessary or abusive use of this tool may result in your own account being suspended.
Are you sure you want to delete your sketch?
Any files uploaded will be deleted as well.
Delete Comment?
This will also delete all the replies to this comment.
Delete this tab? Any code in it will be deleted as well.
Select a collection to submit your sketch
We Need Your Support
Since 2008, OpenProcessing has provided tools for creative coders to learn, create, and share over a million open source projects in a friendly environment.
Niche websites like ours need your continued support for future development and maintenance, while keeping it an ad-free platform that respects your data and privacy!
Please consider subscribing below to show your support with a "Plus" badge on your profile and get access to many other features!
CC Attribution NonCommercial ShareAlike
Genuary 21: Tapeworms (Mashup)
Pagurek
xxxxxxxxxx
let fbo
let blurShader
let font
let wiggleShader
function preload() {
// Nunito 900
font = loadFont('https://fonts.gstatic.com/s/nunito/v16/XRXW3I6Li01BKofAtsGkZuHJeTsfDQ.ttf')
}
function setup() {
createCanvas(600, 600, WEBGL)
wiggleShader = createShader(...wiggleShaderSource())
fbo = new Framebuffer(window)
blurShader = createShader(vert, frag)
}
let shape
let rotX
let rotY
let bgColor
function regenerate() {
if (shape) {
_renderer._freeBuffers(shape.gid)
}
shape = bezierToPipeGeom(genBezier())
rotX = random(-1,1) * 0.0001
rotY = random(-1,1) * 0.0001
bgColor = color(random([
'#99D0F2',
'#024959',
'#026873',
'#0BADBF',
'#D9A491',
]))
}
let lastShapeIdx = -1
function draw() {
const millisPerShape = 5000
const shapeIdx = floor(millis() / millisPerShape)
if (!shape || shapeIdx !== lastShapeIdx) {
regenerate()
lastShapeIdx = shapeIdx
}
const eyeZ = (height/2) / tan(PI/6)
const near = eyeZ/10
const far = eyeZ*10
perspective(PI/3, width/height, near, far)
const targetDepth = 500 + 150 * sin(millis() * 0.001)
const blurIntensity = 0.03
fbo.draw(() => {
clear()
push()
background(bgColor)
noStroke()
fill(200)
ambientLight(color('#baddf5'))
//ambientLight(color('#72ba72'))
pointLight(200, 200, 200, width/2, -height/2, 200)
pointLight(100, 20, 20, -width/2, height/2, 200)
rotateY(millis() * rotY)
rotateX(millis() * rotX)
//scale(4)
shader(wiggleShader)
wiggleShader.setUniform('time', millis())
model(shape)
pop()
})
clear()
push()
noStroke()
rectMode(CENTER)
shader(blurShader)
_renderer.getTexture(fbo.depth).setInterpolation(
_renderer.GL.NEAREST,
_renderer.GL.NEAREST
)
blurShader.setUniform('uImg', fbo.color)
blurShader.setUniform('uDepth', fbo.depth)
blurShader.setUniform('uSize', [width, height])
// try replacing blurIntensity with 0 to see an unblurred version
blurShader.setUniform('uIntensity', blurIntensity)
blurShader.setUniform('uNumSamples', 25)
blurShader.setUniform('uTargetZ', targetDepth)
blurShader.setUniform('uNear', near)
blurShader.setUniform('uFar', far)
rect(0, 0, width, -height)
pop()
}
See More Shortcuts