# WCCChallenge_Gravity

# Gravity&Chaos

For this week's Creative Code Challenge by ***@sableraph***: *"Gravity"*, **Gravity&Chaos**  is coded in  ***Livecodelab , Hydra, & SonicPi*** to get a first look at *intergalactic gravitational* pulling and its effects it has on ***multidimensional*** space travelling

## **Gravitational Design**

* Evoking Chaos & Orbital effects through ***LiveCodeLab***
    
* And adding more texture to that via ***Hydra, Oil Paint Filter*** and *360* looks
    
* The audio is coded in ***SonicPi*** to represent a wild space ride (with additional filters)
    

## Poetry

```javascript
Travelling into Multiple Gravitational pulls
Pulling each Direction
Each sector of the Dimensions
From Peaks to Depressions
The pulls get Strong
The pulls Start to become More than a Handful
Multiple Roomfuls, Shelffuls
Becoming more Prominent as the trip Prolongs
Chaotic Bounces Acting like Rallies from Ping Pong
But at the Same T
ime, Rhythmic as a Verse of a Song
```

## Video

<iframe width="560" height="315" src="https://www.youtube.com/embed/XiHo1_umny4?si=0RNurUzil-ZsApV_"></iframe>

## Code

### LiveCodeLab

```javascript
colors = [yellow,blue,orange,red,gold,black]

if time % 30 > 18
	simpleGradient salmon,colors[time % 6],color((time % 15) * 15, 255 - (5 * time % 18),(time % 85) * 3)
else
	simpleGradient yellow,salmon,color((time % 15) * 15, 255 - (5 * time % 18),(time % 85) * 3)

if time % 20.0 > 6.0
    animationStyle motionBlur

if time % 30.0 > 15.0
    scale (sin(time) + (time % 13.0)/2.0 + 0.1)/4.0
    rotate sin(time),Math.pow(time,time%5),sin(time % 6.0 + 1.0)
else
    scale Math.cbrt((sin(time) + (time % 13.0)/2.0 + 0.1)/4.0)
    rotate Math.sqrt((time),cos(time),sin(time % 6.0 + 1.0)),wave(0.03)

fill blue
    noStroke
    box 1.0 + sin(wave(0.3)),2.0 * wave(0.05), sin(wave(0.43))

move 1.0,Math.sqrt(time %7.0+2.0),1
    fill orange
    noStroke
    peg 1.0 + sin(wave(0.3)),2.0 * Math.cbrt(wave(0.05)), sin(wave(0.43))

move 2.0,Math.hypot(time %6,Math.cbrt(wave(sin(time%2)))),Math.cbrt(time % 9.0 +1.0)
    fill white
    noStroke
    box 1.0 + sin(wave(0.3)),2.0 * wave(0.05), sin(wave(0.43))

move cos(time),2.0,wave(0.03)
    fill red
    stroke color(time % 10.0 * 25.0, sin(wave(0.003) * 50.0))
    ball 1.0 + sin(wave(0.3)),2.0 * wave(0.05), sin(wave(0.43))

50 times with i
	rotate time * 2 + sin(i)
		move cos(wave(0.003)),-cos(wave(0.003)) * (time % 12 + 0.1), sin(wave(0.003))
			box Math.cbrt(i/50), Math.sqrt(i * wave(0.0003))+2, Math.cbrt(i*wave(0.003))
```

### Hydra

```javascript
s0.initScreen();
src(s0)
	.scale(1.5)
	.diff(src(s0)
		.rotate([0.393, 1, 2, 3, 1, 0.5], [0.5, 1, 1.5, 2, 1].smooth())
		.scale(2.5))
	.kaleid([2.5, 1.5, 7.5].smooth())
	.modulateKaleid(src(s0)
		.add(s0)
		.rotate(0.5, 0.5)
		.repeat(3, 3), 0.5)
	.out();
```

### SonicPi

```ruby

live_loop :space1 do
  use_bpm 12
  use_random_seed Math.cbrt(Time.now.to_i)
  with_fx [:distortion,:ping_pong].choose, mix: rrand(0.1,0.7) do
    with_fx :reverb, mix: 0.5 do
      s = synth [:piano, :prophet, :chipbass].choose, amp: rrand(0.5, 1), attack: dice(4) + 1, sustain: dice(5) + 1, release: dice(5) + 2, cutoff_slide: rrand(0, 5), cutoff: rrand(60, 100), pan: rrand(-1, 1)
      c = note [:A4, :B4, :C4].choose, sustain: 2
      control [s,c].choose
      sleep rrand(2, 5)
    end
  end
end

live_loop :space2 do
  use_bpm 20
  use_random_seed Math.sqrt(Time.now.to_i)
  with_fx :ping_pong, mix: rrand(0.1,0.7) do
    with_fx :reverb, mix: 0.5 do
      s = synth [:bnoise, :cnoise, :gnoise, :piano, :prophet, :chipbass].choose, amp: rrand(0.5, 1.5), attack: rrand(0, 4), sustain: rrand(0, 2), release: rrand(1, 5)
      b = synth [:chiplead,:hollow,:beep].choose, amp: rrand(0.5, 1), attack: rrand(0, 4), sustain: rrand(0, 2), release: rrand(1, 5)
      control [s,b].choose, pan: rrand(-1, 1), cutoff: rrand(60, 110)
      sleep [0.5,1, rrand(0.5, Math.sqrt(Time.now.to_i) % 5)].choose
    end
  end
end

live_loop :bell do
  use_random_seed (Time.now.to_i)
  with_fx [:ixi_techno,:flanger,:ping_pong].choose, mix: rrand(0.2,0.7) do
    use_random_seed (Time.now.to_i)
    use_bpm [120,80,220].choose
    ambi = sample [:perc_bell,:elec_bell,:loop_electric,:ambi_lunar_land].choose, rate: (rrand 0.125,1.85), amp: dice(3) + 1
    ambi2 = sample [:ambi_drone,:ambi_glass_hum,:elec_fuzz_tom,:elec_beep].choose,beat_stretch: [1,0.5,0.8].choose, rate: [0.5,0.4,0.3,0.2,0.3,0.4].tick
    control [ambi,ambi2].choose, pan: rrand(-1, 1)
    sleep rrand(0.2,5)
  end
end



```
