Skip to content

Instantly share code, notes, and snippets.

@C4Tutorials
Created May 9, 2013 01:32
Show Gist options
  • Save C4Tutorials/5544932 to your computer and use it in GitHub Desktop.
Save C4Tutorials/5544932 to your computer and use it in GitHub Desktop.
Distortion Cube for VIVO
//
// C4WorkSpace.m
// MediaMashup
//
// Created by moi on 13-05-08.
// Copyright (c) 2013 moi. All rights reserved.
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace
-(void)setup {
C4Image *icon = [C4Image imageNamed:@"[email protected]"];
icon.perspectiveDistance = 300;
icon.userInteractionEnabled = NO;
icon.rotationY = QUARTER_PI;
icon.center = CGPointMake(self.canvas.center.x+icon.width/3 - .5,self.canvas.center.y);
[self.canvas addImage:icon];
C4Image *icon2 = [C4Image imageNamed:@"icon"];
icon2.perspectiveDistance = 300;
icon2.userInteractionEnabled = NO;
icon2.rotationY = -QUARTER_PI;
icon2.center = CGPointMake(self.canvas.center.x-icon.width/3+.5,self.canvas.center.y);
[self.canvas addImage:icon2];
C4Image *icon3 = [C4Image imageNamed:@"icon"];
icon3.perspectiveDistance = 300;
icon3.userInteractionEnabled = NO;
icon3.rotation = -QUARTER_PI*1.5;
icon3.rotationX = -.75;
icon3.rotationY = -7.25;
icon3.center = CGPointMake(self.canvas.center.x,self.canvas.center.y+95 + .5);
[self.canvas addImage:icon3];
C4Image *icon4 = [C4Image imageNamed:@"icon"];
icon4.perspectiveDistance = 300;
icon4.userInteractionEnabled = NO;
icon4.rotation = -QUARTER_PI*1.5+PI;
icon4.rotationX = -.75;
icon4.rotationY = -7.25;
icon4.center = CGPointMake(self.canvas.center.x,self.canvas.center.y-95 - .5);
[self.canvas addImage:icon4];
CGPoint polyPoints[9] = {
CGPointMake(275.00,425.00),
CGPointMake(385.00,450.00),
CGPointMake(495.00,425.00),
CGPointMake(495.00,605.00),
CGPointMake(385.00,675.00),
CGPointMake(275.00,605.00),
CGPointMake(275.00,425.00),
CGPointMake(385.00,350.00),
CGPointMake(495.00,425.00),
};
C4Shape *polygon = [C4Shape polygon:polyPoints pointCount:9];
polygon.fillColor = [UIColor clearColor];
polygon.userInteractionEnabled = NO;
[self.canvas addShape:polygon];
CGPoint centerPoint = CGPointMake(385, 574);
for(int i =1; i < 6; i+= 2) {
CGPoint linePoints[2] = {centerPoint,polyPoints[i]};
C4Shape *line = [C4Shape line:linePoints];
[self.canvas addShape:line];
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment