ProcessingKit
ProcessingKit copied to clipboard
Frame rate is inconsistent in a Playground
Running ProcessingKit in a playground results in an inconsistent frame rate. (MacOS)
I spent a while trying to fix this but I can't figure out what's causing the slowdown.
//: A Cocoa based Playground to present user interface
import AppKit
import PlaygroundSupport
import ProcessingKit
public class SampleView: ProcessingView {
func setup() {
frameRate(5)
}
var start = Date()
func draw() {
let elapsed = start.timeIntervalSinceNow
(print(-1.0/elapsed))
(start = Date())
}
}
let view = SampleView(
frame: NSRect(x: 0, y: 0, width: CGFloat(400), height: CGFloat(400))
)
PlaygroundPage.current.liveView = view
PlaygroundPage.current.needsIndefiniteExecution = true