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!