Skip to content

Instantly share code, notes, and snippets.

View traviskirton's full-sized avatar

Travis traviskirton

View GitHub Profile
@traviskirton
traviskirton / WorkSpace.swift
Created May 5, 2016 02:41
Simple demo of ScreenRecorder... Creates animated points when the user quickly flicks the screen.
// import C4
import UIKit
class WorkSpace: CanvasController {
var screenRecorder: ScreenRecorder?
override func setup() {
self.screenRecorder = ScreenRecorder()
self.screenRecorder?.recordingEndedAction = {
self.screenRecorder?.showPreviewInController(self)
}
@traviskirton
traviskirton / WorkSpace.swift
Last active June 13, 2018 16:46
Drawing Shapes to a PDF
// Copyright © 2014 C4
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: The above copyright
// notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
@traviskirton
traviskirton / WorkSpace.swift
Last active April 20, 2016 05:07
Drawing Shapes to a PDF
import UIKit
class WorkSpace: CanvasController {
var pdfContext: CGContext!
var shapes: [Shape]!
override func setup() {
shapes = [Shape]()
for i in 0..<10 {
let center = Point(Double(i) * 30.0, Double(i) * 30.0)
let circle = Circle(center: center, radius: 30.0)
@traviskirton
traviskirton / WorkSpace.swift
Last active April 15, 2016 20:02
Example rendering various overlaid canvases.
// Copyright © 2014 C4
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: The above copyright
// notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
@traviskirton
traviskirton / WorkSpace.swift
Created April 11, 2016 09:39
Processing Updated
class WorkSpace: CanvasController {
override func setup() {
array2D()
}
func array2D() {
let maxDistance = distance(Point(), rhs: canvas.center)
canvas.backgroundColor = black
var pt = Point(8, 8)
@traviskirton
traviskirton / WorkSpace.swift
Created April 11, 2016 09:22
Updated Basics
import UIKit
class WorkSpace: CanvasController {
override func setup() {
sequenceAnimation()
}
func sequenceAnimation() {
let square = Rectangle(frame: Rect(0,0,100,100))
square.center = canvas.center
@traviskirton
traviskirton / ViewController.swift
Created April 9, 2016 16:17
Half the Scrollview
class ViewController: UIViewController, UIScrollViewDelegate {
@IBOutlet var scrollView: UIScrollView?
var elementSize = CGSizeZero
var grid = (6, 8)
var container: UIView?
override func viewDidLoad() {
scrollView?.delegate = self
elementSize = UIImage(named: "chop")!.size
//
// ViewController.swift
// MMRun
//
// Created by travis on 2016-03-28.
// Copyright © 2016 C4. All rights reserved.
//
import UIKit
@traviskirton
traviskirton / ViewController.swift
Created April 2, 2016 22:54
Final Version of Gestures
//
// ViewController.swift
// Gestures
//
// Created by travis on 2016-03-28.
// Copyright © 2016 C4. All rights reserved.
//
import UIKit
//
// ViewController.swift
// Gestures
//
// Created by travis on 2016-03-28.
// Copyright © 2016 C4. All rights reserved.
//
import UIKit