xxxxxxxxxx
//Code by Aaron Reuland
//Photos by Eadweard Muybridge
//for the #wccChallenge on the theme of 'unrealistic horse'.
//Unrealistic? To paraphrase Rene Magritte's 'The Treachery of Images' : Ceci n'est pas un cheval.
let pics=[]
let dim, colorSpeed
let colors=["#2a274a","#3d3829","#729880","#d0d074","#719c67","#70732b","#a6690e","#a53c0b"]
function preload(){
for(let i=0; i<12; i++ ){
let p=loadImage(i+'.png')
pics.push(p)
}
}
function setup() {
let m=min(windowWidth, windowHeight)
createCanvas(m, m, WEBGL);
dim= m/5
background(0);
imageMode(CENTER)
}
function draw() {
colorSpeed= frameCount/200
translate(-width/2, -height/2)
let count=0
if(frameCount%10==0){
for(let y=dim/2; y<height+dim; y+=dim){
for(let x=dim/2; x<width+dim; x+=dim){
count++
tint(colorMixer(x, y, colors))
push()
translate(x, y)
rotate(count*HALF_PI)
image(pics[(frameCount+count)%pics.length], 0, 0, dim, dim)
pop()
}
}
}
push()
tint(255)
blendMode(MULTIPLY)
if(frameCount%10==0){
image(pics[frameCount%pics.length], width/2, height/2, dim*3, dim*3)
}
pop()
}
function colorMixer(x, y, colorArray) {
let c = noise(x/150, y/150, colorSpeed) * colorArray.length
let c1 = floor(c)
let c2 = floor(c + 1) % colorArray.length
let color1 = colorArray[c1]
let color2 = colorArray[c2]
let mix = fract(c)
let coloring = color(spectral.mix(color1, color2, mix))
coloring.setAlpha(150)
return coloring
}