Category Archives: coding

Colorpicker

Sometimes I’d like to have a just a simple online color picker that gives you RGB in 0..1 format in an easy-to-copypasta for UIColors so I cobbled together this colorpicker. 


Kaleidoscope Image Creator released

Kaleidoscope Image Creator 1.0 released. This app uses CAReplicatorLayer to duplicate a video stream many times with a transform applied to the backing layer of the UIView. I do this by creating a UIView that returns a ReplicatorLayer as its layerClass

// put this in a UIView, i.e. CamView.m 
+ (Class) layerClass
{
    return [CAReplicatorLayer class];
}

— then add the AVCaptureSession’s preview output to that view’s layer — assuming you have an AVCaptureSetup with a preview layer something like like described in this Apple doc. 

    [[camview layer] addSublayer:[mySessionManager previewLayer];

assuming previewlayer is a AVCaptureVIdeoPreviewLayer , which is a special subclass of CALayer made just for this sort of thing — then run the camview’s layer through the replicator to generate the kaleidoscopic picture.

CAReplicatorLayer *replicator = (CAReplicatorLayer*)camview.layer;    
replicator.instanceCount = 32;
replicate.instanceTransform = CATransform3DMakeRotation(0.2, 0, 0.0, 1.0);

And wham! That’s all it takes to make a fun and easy kaleidoscopic image with CAReplicatorLayer!

 


Earache 1.0 released

Earache 1.0 released, for the very low price of 0.99c. The geek colophon for this app: built using cocos2d-iphone, 1.x tree. It was a great thing to learn, great for creation of sprites and some cool eye candy transitions, like say animating the tint of a button, but if I did it all over again I would just use UIKit, as the UIVIew animation stuff is nicely built in and Apple even provides an emitter with CAEmitterLayer. Anyway check it out.