Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let radius = 100, // radius: blob 的基准半径
- offset = .8, // offset: 根据基准半径的偏移程度
- scale = 20, // scale: 形变的程度
- speed = .02 // speed: 形变的速度
- const width = window.innerWidth, height = window.innerHeight
- function setup() {
- createCanvas(width, height)
- }
- function draw() {
- background(0)
- fill('#ff0000')
- noStroke()
- translate(width / 2, height / 2)
- beginShape()
- for (let i = 0; i < TWO_PI; i += radians(1)) {
- let xOff = offset * cos(i) + .2
- let yOff = offset * sin(i) + .2
- let r = radius + map(noise(xOff, yOff, speed), 0, 1, -scale, scale)
- let x = r * cos(i)
- let y = r * sin(i)
- vertex(x, y)
- }
- endShape()
- speed += .01
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement