# WCCChallenge_Cards

# Wiggly Cards

For this week's Creative Code Challenge by @sableraph : ***Cards***, I decided to have Cards be transformed and wiggle through their existence

This week's coding languages are **Hydra, P5js and SonicPi**

* The movement and augmentation of the cards are done by **Hydra and overlayed**
    
* The Creation and colours of the card are done by **P5js**
    
* The sounds are coded in **SonicPi** using a concept of shadow maths and colour shuffling, where in this case the sounds are made through the values of different blues. As well as their shadow/shuffle counterparts to add variance to the soundscape
    
* OilPaintFIlter
    

## Poem

```ocaml
The Cards are being dealt
but their essence is being swept
swept under the eyes that are now asleep
but once upon time, they were connected and felt
now the disconnect has made them wept
as sleep as the eyes are
and the touch of togetherness is now far
The cards are being dealt
but their memory is contained and kept
```

## Video

<iframe width="560" height="315" src="https://www.youtube.com/embed/smaXcDKxVqQ"></iframe>

## Code

### P5js

```javascript
function setup() {
  createCanvas(800, 800);
}

let filling = [
  "red",
  "blue",
  "orange",
  "yellow",
  "teal",
  "purple",
  "silver",
  "green",
  "teal",
  "black",
  "white",
];


function draw() {
  background(220);
  frameRate(4)

  
if (second() % 7  > 3)
{
cardBlack('orange')
}
else
  {
cardBlack('blue')
strokeWeight(random(3,8))
stroke(random(filling))
  }

if(second() % 8 > 4)
  {
cardWhite('yellow')
  }
  else
{
cardWhite ('red')
}

}


function cardBlack(filler)
{
  fill('black')
  rect(width/2,height/2 - height/9,200,400);
  
  fill(filler)
  ellipse(width/2 + 20,height/2 - height/9 + 20,20,20)
  ellipse(width/2 + 20,height/2 + height/3 + 20,20,20)
  ellipse(width/2 + width/5 + 20,height/2 - height/9 + 20,20,20)
  ellipse(width/2 + width/5 + 20,height/2 + height/3 + 20,20,20)
  
  fill('green')
  ellipse(width/2 + width/8,height/2,50)
  rect(width/2 + width/10,height/2 + height/10,50)
  ellipse(width/2 + width/8,height/2 + height/4,50)
}

function cardWhite(filler)
{
  
fill('white')
  rect(width/2 - width/3,height/2 - height/9,200,400);
  
    fill('red')
  ellipse(width/2 - width/3 + 20,height/2 - height/9 + 20,20,20)
  ellipse(width/2 - width/3 + 170,height/2 + height/3 + 20,20,20)
  ellipse(width/2 - width/3 + 170,height/2 - height/9 + 20,20,20)
  ellipse(width/2 - width/3 + 20,height/2 + height/3 + 20,20,20)
  
  fill(filler)
  rect(width/2 - width/4 + 10,height/2 + height/10,50)
  rect(width/2 - width/4 + 10,height/2 + height/4,50)
  rect(width/2 - width/4 + 10,height/2 - height/14,50)  
  
}
```

### Hydra

```javascript
s0.initScreen();
src(s0).modulateScale(src(s0).modulateRotate(s0).scrollX([0.5,0.3]),0.3)
.modulateRotate(osc(1,3,1).colorama(()=> (time % 7 + 3) / 11),0.7)
.scale(()=> (time % 10 + 3)/9).repeat(()=> (time % 6 + 1)/ 4)
    .out(o0);

speed = 0.5
```

SonicPi

```ruby
#Color +Shadows
#RGB Values + XYZ

#With BPM changes between 30,60,90

#Shadeofred [R,G,B, X, Y, Z]

# CadetBlue : 95, 158, 160,23.29, 29.423,37.708
# SlateBlue : 106, 90, 205,20.617, 14.784, 59.521
# NavyBlue : 0, 0, 128,3.896, 1.558, 20.516

#shadow length equation is Length = height / tan(angle)


#Creating Arrays
CadetBlue = [95, 158, 160,23.29, 29.423,37.708]
SlateBlue = [106, 90, 205,20.617, 14.784, 59.521]
NavyBlue = [0, 0, 128,3.896, 1.558, 20.516]



with_fx :ixi_techno do
  live_loop :reds do
    i = 0
    use_synth :pretty_bell
    play (CadetBlue[i] + SlateBlue[i])/5 ,release: 3
    play CadetBlue[i] ,release: 3
    
    with_fx :ping_pong, mix: rrand(0.3,0.75) do
      use_synth :chiplead
      play (NavyBlue[i] + SlateBlue[i])/5 ,release: 3, decay: dice(4)
    end
    
    sleep [0.5,1,2].choose
    if i < 7
      i+= 1
    end
  end
end

live_loop :redshuffle do
  
  CadetBlueShuffle = CadetBlue.shuffle()
  SlateBlueShuffle = SlateBlue.shuffle()
  NavyBlueShuffle = NavyBlue.shuffle()
  
  i = 0
  use_synth :pretty_bell
  play (CadetBlueShuffle[i] + SlateBlueShuffle[i])/4 ,release: 3
  play CadetBlueShuffle[i] ,release: 3
  
  with_fx :ping_pong, mix: rrand(0.3,0.75) do
    use_synth :piano
    play (NavyBlueShuffle[i] + SlateBlueShuffle[i])/5 ,release: 3, decay: dice(4)
  end
  
  sleep [0.5,1,2].choose
  if i < 7
    i+= 1
  end
end


#shadow length component
with_fx :ixi_techno do
  live_loop :redsshadow do
    i = 0
    use_synth :piano
    play (CadetBlue[i]/Math.tan(70)).abs + (SlateBlue[i]/Math.tan(70)).abs  - 20,release: 3, sustain: 8
    sleep [0.25,0.5,1,2,4].choose
    if i < 7
      i+= 1
    end
  end
end
```
