From 58a744fccac1a831c28eca66c889dd4e21fd6daa Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Tue, 18 Sep 2018 19:23:12 -0700 Subject: [PATCH] More tweaking and clean up --- Waveform/GameViewController.swift | 51 ++++-------------------------- Waveform/art.scnassets/blank.scn | Bin 9759 -> 9757 bytes 2 files changed, 7 insertions(+), 44 deletions(-) diff --git a/Waveform/GameViewController.swift b/Waveform/GameViewController.swift index 0ced5e5..0ebc728 100644 --- a/Waveform/GameViewController.swift +++ b/Waveform/GameViewController.swift @@ -63,10 +63,15 @@ class GameViewController: NSViewController, SCNSceneRendererDelegate { for j in 0.. 0 { - // retrieved the first clicked object - let result = hitResults[0] - - // get its material - let material = result.node.geometry!.firstMaterial! - - // highlight it - SCNTransaction.begin() - SCNTransaction.animationDuration = 0.5 - - // on completion - unhighlight - SCNTransaction.completionBlock = { - SCNTransaction.begin() - SCNTransaction.animationDuration = 0.5 - - material.emission.contents = NSColor.black - - SCNTransaction.commit() - } - - material.emission.contents = NSColor.red - - SCNTransaction.commit() - } } func delayForSphereAt(x: Int, y: Int) -> Double { @@ -146,7 +109,7 @@ class GameViewController: NSViewController, SCNSceneRendererDelegate { let delay = delayForSphereAt(x: x, y: z) let inputX = 0.5 * time + delay - let y = sin(inputX) + sin(2.0 * inputX) + sin(4.0 * inputX) + sin(8.0 * inputX) + let y = (sin(inputX) + sin(2.0 * inputX) + sin(4.0 * inputX) + sin(8.0 * inputX)) / 2.0 node.worldPosition.y = CGFloat(y) @@ -159,6 +122,6 @@ class GameViewController: NSViewController, SCNSceneRendererDelegate { } func map(_ x: Double, inMin: Double, inMax: Double, outMin: Double, outMax: Double) -> Double { - return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin; + return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin } } diff --git a/Waveform/art.scnassets/blank.scn b/Waveform/art.scnassets/blank.scn index 08f35b73304c45463458489facec9471de19e5a5..7c7b1690449bcc7d0daa8d3cd4c692dc291f167c 100644 GIT binary patch delta 308 zcmbR5GuLNABfA2lDx)@|!Nv|FRz{Z1yIDmr+ z8D!RGE|~?)Vxqy$emAv|XsX0zLnR$7e56MfgDu0q@m*$rila`Q{lJ=Jl zln#~-l@6DVkuH>;DZN8_m-HU#kCXqZ%uYWbe^UOc{4M!s^6%yUDX=Q=Du^h^DyS>y zDOf2uE4V1QDfladD8wqHDr70lS6Ha9SYfHcGKJL&cNFd^JWzO~@Lb`8;v>Z;iXRn! nDzPfDD{(4uEBPsfE5#}$DP=2_C{-$TD@{UlRz|kXyIDm<4)S`%U_qjBmYAFqXL5hy8^$0n1Z~5 zrh1BP#R^LmmMg4KSgUYP;eo;XfKsGVyi$r%u2Pv&wNkIrB&F$-|EkI}&IAB^)K`=M