Skip to content

Instantly share code, notes, and snippets.

Avatar

Joshua Sullivan JoshuaSullivan

View GitHub Profile
@JoshuaSullivan
JoshuaSullivan / swift4-kvo-playground.swift
Created May 11, 2018
Here is a playground demonstrating how to set up Swift 4 KVO.
View swift4-kvo-playground.swift
//: # Setting up Swift 4 KVO
import Foundation
//: This class has a pair of properties that can be observied by KVO.
//: - Note: This class *must* inheret from `NSObject` in order to posess the KVO functionality.
class ObservableClass: NSObject {
/// An observable string property. Note that it most be annotated with both "@objc" (expose the property to the
/// Objective-C runtime) and "dynamic" (enables KVO for the property).
@objc dynamic private(set) var stringProperty: String = "Starting string!"
@JoshuaSullivan
JoshuaSullivan / mobius-ring.pde
Created Mar 22, 2018
Processing script for rendering a Möbius Strip.
View mobius-ring.pde
class MobiusRing {
float majorRadius, minorRadius;
int segments;
PVector[] vertices;
MobiusRing(float majorRadius, float minorRadius, int segments) {
this.majorRadius = majorRadius;
this.minorRadius = minorRadius;
this.segments = segments;
@JoshuaSullivan
JoshuaSullivan / CollectionViewDelegateSplitter.swift
Created Dec 8, 2017
These two shims allow you to split the UIScrollViewDelegate calls from the collection and table view delegate calls.
View CollectionViewDelegateSplitter.swift
//
// CollectionViewDelegateSplitter.swift
//
// Created by Joshua Sullivan on 12/7/17.
//
import UIKit
class CollectionViewDelegateSplitter: NSObject, UICollectionViewDelegate {
/// The object which will receive collection-related delegate actions.
@JoshuaSullivan
JoshuaSullivan / arkit-quickstart.markdown
Last active Oct 3, 2017
A quick guide for getting up and running with ARKit.
View arkit-quickstart.markdown

Getting Started with ARKit

First things first: Augmented Reality is an inherently 3D activity. The ease with which you pick it up will be directly proportional to your existing experience working in 3D. This is not to say someone without 3D experience can't do AR, but it will be harder for you until you become more familiar with common 3D principles. The skill set used for creating 3D games and AR experiences are essentially the same.

If your'e a complete 3D noob, I suggest checking out some of the RayWenderlich.com tutorials on getting started with 3D game development.

Step 1: Choose your IDE

The first decision to make is whether you want to use Xcode or a 3D game framework such as Unity or Unreal to create your experience. For the purposes of this guide, I'll assume you will choose Xcode, simply because I have no personal experience with the other two options. If you're already experienced with one of them or are feeling adventurous, then I'm sure you can find AR learning resources online.

X

@JoshuaSullivan
JoshuaSullivan / CapturedImageSampler.swift
Created Oct 1, 2017
The source code for an object that helps you sample RGB values from ARFrames.
View CapturedImageSampler.swift
//
// CapturedImageSampler.swift
// ARKitTest
//
// Created by Joshua Sullivan on 9/22/17.
// Copyright © 2017 Joshua Sullivan. All rights reserved.
//
import UIKit
import ARKit
@JoshuaSullivan
JoshuaSullivan / dmx.swift
Created Aug 31, 2017
In case you were wondering who was going to give it to you…
View dmx.swift
import Swift
struct Giver {
enum Receiver {
case ya
}
private var name: String
init(name: String) {
@JoshuaSullivan
JoshuaSullivan / pillars_fountain.pde
Last active Jul 14, 2017
Some forms of motion amuse the system more than others…
View pillars_fountain.pde
final int PILLAR_ORDER = 12;
final int DIAGONALS = PILLAR_ORDER * 2 - 1;
final float PILLAR_WIDTH = 20.0;
final float PILLAR_HEIGHT = 10.0;
final float PILLAR_SPACING = 2.0;
final float GRAVITY = -1.0;
final float ELASTICITY = -0.5;
final float MAX_HEIGHT = 500.0;
@JoshuaSullivan
JoshuaSullivan / pillars_complexity.pde
Last active Jul 14, 2017
As the system matures, it gains increasingly complex behavior…
View pillars_complexity.pde
final int PILLAR_ORDER = 8;
final int DIAGONALS = PILLAR_ORDER * 2 - 1;
final float PILLAR_WIDTH = 30.0;
final float PILLAR_HEIGHT = 15.0;
final float PILLAR_SPACING = 2.0;
final float GRAVITY = -1.0;
final float ELASTICITY = -0.6;
final float MAX_HEIGHT = 500.0;
@JoshuaSullivan
JoshuaSullivan / pillars_order.pde
Created Jul 6, 2017
Control systems coming online. Order is being established…
View pillars_order.pde
final int PILLAR_ORDER = 6;
final float PILLAR_WIDTH = 40.0;
final float PILLAR_HEIGHT = 20.0;
final float PILLAR_SPACING = 2.0;
final float GRAVITY = -1.0;
final float ELASTICITY = -0.6;
final float MAX_HEIGHT = 500.0;
@JoshuaSullivan
JoshuaSullivan / pillars_chroma.pde
Created Jul 4, 2017
The pillars have undergone chromatic infusion…
View pillars_chroma.pde
final int PILLAR_ORDER = 6;
final float PILLAR_WIDTH = 40.0;
final float PILLAR_HEIGHT = 20.0;
final float PILLAR_SPACING = 2.0;
final float GRAVITY = -1.0;
final float ELASTICITY = -0.6;
final float MAX_HEIGHT = 500.0;
You can’t perform that action at this time.