Search code examples
iosrotationc4

How can I rotate a movie? [C4 Framework]


I am working with the C4 Alpha and I've added a small movie to the canvas but I don't know how to rotate it into the right position.

Here's my code:

-(void)setup {
C4Movie *newMovie = [C4Movie movieNamed:@"IMG_0009.MOV"];
newMovie.center = CGPointMake(384,512);
[self.canvas addMovie:newMovie];
}

Thank you.


Solution

  • Currently, in the C4 alpha api, the only way to do rotations is to use CGAffineTransform()...

    So, your example would look like:

    -(void)setup {
        C4Movie *newMovie = [C4Movie movieNamed:@"IMG_0009.MOV"];
        newMovie.center = CGPointMake(384,512);
        newMovie.transform = CGAffineTransformMakeRotation(PI);
        [self.canvas addMovie:newMovie];
    }
    

    PI will rotate your movie by 180 degrees, PI/2 = 90, etc...