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!
Will stop at frame 1000.
CC Attribution NonCommercial ShareAlike
沉默的羔羊
Chen
xxxxxxxxxx
// https://www.fxhash.xyz/generative/slug/lambs
const colors = ["#F00", "#FF0", "#0F0", "#0FF", "#00F", "#000", "#FFF"]
let bgColor, bloodColor
const totalFrame = 1000
const lifeStep = 0.005
let [wOff, hOff] = [200, 200]
let [cols, rows] = [100, 100]
let xoff, yoff
let nodes = Array.from({ length: rows }, () => Array.from({ length: cols }))
let noiseScale = 0.01
let weiRangeMax
let maxSide
function setup() {
createCanvas(1200, 370)
flex({ container: { padding: "20px" } })
const tone = [random(225, 255), random(225, 255), random(225, 255)]
bgColor = color(...tone)
background(bgColor)
bloodColor = color(random(colors))
noFill()
noiseScale = random(0.005, 0.01)
weiRangeMax = 2 ** floor(random(3, 9))
maxSide = max(width, height)
cols = floor(random(1, 11)) * 10
xoff = (width - wOff) / cols
yoff = (height - hOff) / rows
for (let col = 0; col < cols; col++) {
for (let row = 0; row < rows; row++)
nodes[row][col] = new Node(col * xoff, row * yoff)
}
describe(`"Lamb" by Zaron Chen`)
}
let t
let weiCtrl
function draw() {
t = frameCount / totalFrame
weiCtrl = lerp(noise(t, t) * width, width / 2, t)
push()
translate((wOff + xoff) / 2, (hOff + yoff) / 2)
let dotColor = lerpColor(color(0), bloodColor, 0.5 - 0.5 * cos(2 * t))
dotColor.setAlpha(50)
stroke(dotColor)
nodeUpdate(static_dots)
nodeUpdate(motion_dots)
pop()
push()
stroke(bgColor)
strokeWeight(25)
rect(0, 0, width, height)
pop()
if (frameCount >= totalFrame) noLoop()
}
function nodeUpdate(display) {
let nz = frameCount * noiseScale
for (let col = 0; col < cols; col++) {
for (let row = 0; row < rows; row++) {
const node = nodes[row][col]
const nx = node.x * noiseScale
const ny = node.y * noiseScale
const dx = noise(nx + 300, ny + 500, nx + ny + nz) * 2 - 1
const dy = noise(nx + 100, ny + 300, nx + ny + nz) * 2 - 1
const range = floor(random(1, random(2, weiRangeMax)))
const wei = map(weiCtrl, 0, maxSide, -range, range) * (1 - t)
display(node, dx, dy * (1 - abs(wei) / range) * 20, wei)
}
}
}
function static_dots(node, dx, dy, wei) {
node.mx = node.x + dx * wei * 100 * sin(t)
node.my = node.y + dy * wei * 210 * sin(t)
point(node.mx, node.my)
}
function motion_dots(node, dx, dy, wei) {
node.x = node.x + dx * wei
node.y = node.y + dy * wei
node.life -= lifeStep
if (node.life < 0) node.reset()
point(node.x, node.y)
}
class Node {
constructor(x, y) {
this.x = x
this.y = y
this.mx = x
this.my = y
this.life = random(3)
}
reset() {
this.x = this.mx
this.y = this.my
this.life = random(3)
}
}
See More Shortcuts