Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Last active December 16, 2015 19:51
Show Gist options
  • Save fjolnir/5488350 to your computer and use it in GitHub Desktop.
Save fjolnir/5488350 to your computer and use it in GitHub Desktop.
import "math"
import "AppKit"
import "QuartzCore"
nsapp = NSApplication sharedApplication
a = CALayer new setDoubleSided: yes;
setBackgroundColor: CGColorCreateGenericRGB(1,0,0,1);
self
b = CALayer new setDoubleSided: yes;
setTransform: CATransform3DMakeRotation(M_PI, 0, 1, 0);
setBackgroundColor: CGColorCreateGenericRGB(0,1,0,1);
setZPosition: 0.1;
self
c = CATransformLayer new
winBounds = [NSZeroPoint, [300, 200]]
win = (NSWindow alloc initWithContentRect: winBounds
styleMask: (NSTitledWindowMask bitOr: NSResizableWindowMask)
backing: NSBackingStoreBuffered
defer: no)
setContentView: (NSView new setWantsLayer: yes; self);
self
win contentView layer addSublayer: c
c addSublayer: a; addSublayer:b
a setFrame: winBounds
b setFrame: winBounds
c setFrame: winBounds
NSTimer scheduledTimerWithTimeInterval: 2
target:`c setTransform: CATransform3DRotate(c transform, M_PI, 0, 1, 0)` copy
selector: #call
userInfo: nil
repeats: yes
win makeKeyAndOrderFront: nil
nsapp setActivationPolicy: NSApplicationActivationPolicyRegular;
activateIgnoringOtherApps: yes;
run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment