Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

galaxy joystick & images #31

Merged
merged 6 commits into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added data/images/astrallogo_clean_stroked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/dj_attempt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/dj_johney.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/dj_kid_kodama.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/dj_matsem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/dj_rough_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/dj_sbu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/dj_seba.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/main/kotlin/dev/matsem/astral/sketches/SketchLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import dev.matsem.astral.sketches.blank.BlankSketch
import dev.matsem.astral.sketches.boxes.BoxesSketch
import dev.matsem.astral.sketches.cubes.CubesSketch
import dev.matsem.astral.sketches.fibonaccisphere.FibSphereSketch
import dev.matsem.astral.sketches.galaxy.GalaxySketch
import dev.matsem.astral.sketches.gameoflife.GameOfLifeSketch
import dev.matsem.astral.sketches.patterns.PatternsSketch
import dev.matsem.astral.sketches.polygonal.PolygonalSketch
import dev.matsem.astral.sketches.spikes.SpikesSketch
import dev.matsem.astral.sketches.galaxy.GalaxySketch
import dev.matsem.astral.sketches.starglitch.StarGlitchSketch
import dev.matsem.astral.sketches.terrain.TerrainSketch
import dev.matsem.astral.sketches.video.VideoSketch
Expand Down Expand Up @@ -170,6 +170,7 @@ class SketchLoader : PApplet(), KoinComponent {
galaxy.createPushButton(15, 8) { switchSketch('9') }
galaxy.createPushButton(15, 9) { switchSketch('p') }
galaxy.createPushButton(15, 10) { switchSketch('m') }
galaxy.createPushButton(15, 11) { switchSketch('s') }

if (Config.VideoExport.IS_IN_RENDER_MODE) {
frameRate(1000f)
Expand Down
43 changes: 38 additions & 5 deletions src/main/kotlin/dev/matsem/astral/sketches/galaxy/GalaxySketch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,20 @@ class GalaxySketch : BaseSketch(), KoinComponent {
GalaxyImage(path = "images/galaxy1.png", pixelStep = 3, threshold = 60f),
GalaxyImage(path = "images/galaxy2.png", pixelStep = 2, threshold = 50f),
GalaxyImage(path = "images/galaxy1.png", pixelStep = 3, threshold = 50f),
GalaxyImage(path = "images/galaxy2.png", pixelStep = 2, threshold = 40f)
GalaxyImage(path = "images/galaxy2.png", pixelStep = 2, threshold = 40f),
GalaxyImage(path = "images/dj_attempt.png", pixelStep = 3, threshold = 50f),
GalaxyImage(path = "images/dj_johney.png", pixelStep = 3, threshold = 50f),
GalaxyImage(path = "images/dj_kid_kodama.png", pixelStep = 3, threshold = 50f),
GalaxyImage(path = "images/dj_matsem.png", pixelStep = 3, threshold = 50f),
GalaxyImage(path = "images/dj_rough_result.png", pixelStep = 3, threshold = 50f),
GalaxyImage(path = "images/dj_sbu.png", pixelStep = 3, threshold = 50f),
GalaxyImage(path = "images/dj_seba.png", pixelStep = 3, threshold = 50f),
GalaxyImage(path = "images/astrallogo_clean_stroked.png", pixelStep = 4, threshold = 50f)
)

// region remote control

private val galaxyImageButtons = galaxy.createPushButtonGroup(10, listOf(4, 5, 6, 7)) {
private val galaxyImageButtons = galaxy.createPushButtonGroup(10, listOf(4, 5, 6, 7, 24, 25, 26, 27, 28, 29, 30, 31)) {
createGalaxy(images[it])
}

Expand All @@ -62,7 +70,26 @@ class GalaxySketch : BaseSketch(), KoinComponent {
private val zoomHzSlider = galaxy.createPot(channel = 10, cc = 11, min = 1 / 60f, max = 1 / 5f, initialValue = 1 / 60f)
private val zoomMinSlider = galaxy.createPot(channel = 10, cc = 12, min = 1f, max = 4f, initialValue = 1f)
private val zoomMaxSlider = galaxy.createPot(channel = 10, cc = 13, min = 1f, max = 4f, initialValue = 2f)
private var joystick = galaxy.createJoystick(
channel = 10,
ccX = 17,
ccY = 18,
ccTouchXY = 19,
ccZ = 20,
ccTouchZ = 21,
ccFeedbackEnabled = 22
)

private var rotationResetButton = galaxy.createPushButton(10, 23) {
rotX = 0f
rotY = 0f
rotZ = 0f
}

private var zoomValue = 1f
private var rotX = 0f
private var rotY = 0f
private var rotZ = 0f

private val randomDiametersButton = galaxy.createToggleButton(channel = 10, cc = 14, defaultValue = false)
private val starDiameterSlider = galaxy.createPot(channel = 10, cc = 15, min = 0.5f, max = 1.5f, initialValue = 1f)
Expand Down Expand Up @@ -154,11 +181,20 @@ class GalaxySketch : BaseSketch(), KoinComponent {

override fun draw() = with(sketch) {
automator.update()

val diameterFactor = starDiameterSlider.value
rotX += joystick.x * 0.01f
rotY += joystick.y * 0.01f
rotZ += joystick.z * 0.01f

beatCounter.update()
background(bgColor)

translateCenter()
rotateX(rotX)
rotateY(rotY)
rotateZ(rotZ)

noFill()
stroke(fgColor)

Expand All @@ -172,7 +208,6 @@ class GalaxySketch : BaseSketch(), KoinComponent {
synchronized(lock) {
galaxyStars.forEach {
pushMatrix()
translateCenter()
scale(zoomValue)

it.rotationExtra += audioProcessor.getRange(1000f..4000f).remap(0f, 100f, 0f, 0.02f) * it.randomFactor
Expand All @@ -199,7 +234,6 @@ class GalaxySketch : BaseSketch(), KoinComponent {
)
.forEach {
pushMatrix()
translateCenter()
scale(zoomValue)
it.rotationExtra += audioProcessor.getRange(2500f..16000f).remap(0f, 100f, 0f, 0.2f) * it.randomFactor
rotateY(millis() * it.ySpeed + it.rotationExtra)
Expand All @@ -212,7 +246,6 @@ class GalaxySketch : BaseSketch(), KoinComponent {

// Black hole
pushMatrix()
translateCenter()
scale(zoomValue)
noStroke()
fill(bgColor)
Expand Down
Binary file modified touchosc/Astral.touchosc
Binary file not shown.