Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Frame rate is inconsistent in a Playground #117

Open
robseward opened this issue Apr 10, 2019 · 0 comments
Open

Frame rate is inconsistent in a Playground #117

robseward opened this issue Apr 10, 2019 · 0 comments

Comments

@robseward
Copy link

robseward commented Apr 10, 2019

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant