Skip to content

Instantly share code, notes, and snippets.

@C4Code
C4Code / C4WorkSpace.m
Created January 24, 2013 22:49
Example of a custom slider. You can copy the contents of C4WorkSpace, and then drag / drop the other two files into your project.
//
// Slider.h
//
// Created by Travis Kirton.
//
#import "C4WorkSpace.h"
#import "Slider.h"
@implementation C4WorkSpace {
@C4Code
C4Code / C4WorkSpace.m
Created January 24, 2013 20:48
Example of tying the movement of two objects together with Listeners and Gestures
//
// C4WorkSpace.m
//
// Created by Travis Kirton
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace {
C4Shape *s1, *s2;
@C4Code
C4Code / C4WorkSpace.m
Created January 23, 2013 05:05
Difference between scaling and doubling the size of a bezier path... Scaling actually distorts the size of the shape's border.
@implementation C4WorkSpace {
C4Shape *s, *t;
}
-(void)setup {
s = [C4Shape rect:CGRectMake(20, 20, 100, 100)];
[self.canvas addShape:s];
t = [C4Shape rect:CGRectMake(400, 20, 100, 100)];
[self.canvas addShape:t];
@C4Code
C4Code / C4WorkSpace.m
Created January 23, 2013 03:50
Example showing how to add multiple objects to the canvas or any other visible object.
//
// C4WorkSpace.m
//
// Created by Travis Kirton
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace {
C4Shape *s;
@C4Code
C4Code / C4WorkSpace.m
Created January 20, 2013 23:39
Simple example using the perspectiveDistance property
//
// C4WorkSpace.m
//
// Created by Travis Kirton
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace {
C4Image *image;
@C4Code
C4Code / C4WorkSpace.m
Created January 20, 2013 23:37
More complex example of using the perspectiveDistance property
//
// C4WorkSpace.m
// test
//
// Created by moi on 13-01-20.
// Copyright (c) 2013 moi. All rights reserved.
//
#import "C4WorkSpace.h"
@C4Code
C4Code / C4WorkSpace.m
Created January 20, 2013 23:35
Basic example for how to change a visible object's shadow path
//
// C4WorkSpace.m
//
// Created by Travis Kirton.
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace {
C4Shape *s, *c;
@C4Code
C4Code / C4WorkSpace.m
Created January 20, 2013 23:33
Basic example of how to create a CGPath to use for a visible object's shadowPath property
//
// C4WorkSpace.m
// test
//
// Created by moi on 13-01-20.
// Copyright (c) 2013 moi. All rights reserved.
//
#import "C4WorkSpace.h"
@C4Code
C4Code / C4WorkSpace.m
Created December 10, 2012 18:19
hit testing a shape, adding shapes within another shape
#import "C4WorkSpace.h"
@implementation C4WorkSpace {
C4Shape *t;
}
-(void)setup {
t = [C4Shape arcWithCenter:CGPointMake(180, 180) radius:180 startAngle:0
endAngle:PI clockwise:NO];
[self.canvas addShape:t];
@C4Code
C4Code / C4WorkSpace.m
Created December 10, 2012 16:24
3 distinct tap gestures
#import "C4WorkSpace.h"
@implementation C4WorkSpace
-(void)setup {
UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(one)];
UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(two)];
tap2.numberOfTapsRequired = 2;
UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(three)];
tap3.numberOfTapsRequired = 3;