xxxxxxxxxx
80
let pace = 4 // massage speed
// hand touching
let tMinD = 5 // touch min duration-pressure (sec?)
let tMaxD = 20 // touch max duration-pressure (sec?)
let tMaxP = 2 // max pause between two touches (sec?)
let tMinS = 5 // max size of touches (cm?)
let tMaxS = 30 // max size of touches (cm?)
// waves (of pleasure?)
let wSns = 6 // sensitivity (0-10) to touch duration-pressure
let wSpd = 5 // wave intensity-speed
function setup() {
createCanvas(512, 265);
noStroke()
t = 0
tt = 0
tx = random(150, 350)
ty = random(100, 200)
tl = random(tMinD, tMaxD)
ts = random(tMinS, tMaxS)
tlr = tMaxD - tMinD
wtrsh = tMinD + wSns * tlr / 10
}
function draw() {
// time passing
t += pace / 100
background(0)
const tcd = tt + tl - t
// pauses = do nothing
if (tt > t) {}
// touch circles
else if (tcd > 0) {
const d = (tcd > tl / 2) ? tl - tcd : tcd
const ad = (tcd > tl / 2) ? tcd : tl - tcd
let a = 0
for (let r = d; r > 0; --r) {
fill(a);
ellipse(tx, ty, ts * r, ts * r)
a += 255 / ad
}
// waves of tension release
if (wSns / 15 > tcd / tl && wtrsh >= tl) {
for (let px = 0; px < width / 5; px++) {
const x = px * 5
if (x < tx + 8 && x > tx - 8) {
for (let py = 0; py < height / 5; py++) {
const y = py * 5
let dty = abs(ty - y) * pow(tcd / tl, wSpd / 2)
if (dty > 5) {
fill(50 * (tl - tcd));
ellipse(x, y, 1, 1)
}
}
}
}
}
} else {
// generate new touch
tt = t + random(0, tMaxP)
tx = random(150, 350)
ty = random(100, 200)
tl = random(tMinD, tMaxD)
ts = random(tMinS, tMaxS)
}
}
function drawGradient(x, y, radius) {
let h = 250;
}
function keyPressed() {
if (key === 's') {
saveGif('S1.gif', 15);
}
}