Perlin noise for plotting n coordinates?

@UberGoober I guess it depends on the screen size. It doesn’t scroll on my iPad, I have to wait for the update each time. Maybe if my iPad was faster.

This version modularizes the cloud function so it can draw to any image supplied to it.

It also animates the clouds, but verrrrry slowly, because if I tried to make it go any faster it looked really choppy.


function setup() 
    parameter.number("xVal",-5,5,0)   
    parameter.number("yVal",-5,5,0)
    parameter.integer("thisRange",1,10,3)
    p=craft.noise.perlin()
    
    imageToUse = image(WIDTH, HEIGHT)
    spriteMode(CENTER)
end

function cloud(targetImg, xOffset, yOffset, range)   
    local tab={}
    xOffset, yOffset = xOffset or 1, yOffset or 1  
    range = range or 1
    local min,max=0,0    
    for x=1, targetImg.width do
        tab[x]={}
        local x1=x/(targetImg.width/range)
        for y=1,targetImg.height do
            tab[x][y]={}
            local y1=y/(targetImg.height/range)
            local z=p:getValue(x1+xOffset,y1+yOffset,0)
            tab[x][y]=z
            max = math.max(max, z)
            min = math.min(min, z)
        end
    end
    local col=256/(max-min)    
    setContext(targetImg)
    for x=1, targetImg.width do
        for y=1, targetImg.height do
            local c=(tab[x][y]+math.abs(min))*col
            targetImg:set(x,y,color(c,c,c,c))
        end
    end
    setContext() 
    return targetImg
end

function draw()
    xVal = xVal + (ElapsedTime * 0.0003)
    yVal = yVal + (ElapsedTime * 0.0003)
    cloud(imageToUse, xVal, yVal, thisRange)
    background(33, 140, 204)
    sprite(imageToUse, WIDTH * 0.65, HEIGHT * 0.65, WIDTH / 1.75, HEIGHT/1.75)
end

@UberGoober That scrolls better.

PS. If I look out my windows right now, those are the kind of clouds I see.