Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

liptonlover

macrumors 6502a
Original poster
Mar 13, 2008
989
0
I'm working on learning core animation right now, though it's hard since everything I find is complicated demonstrations and not tutorials. Anyways, I'm doing well enough, but I want to know how to move an object on all three axis. I can't figure out AT ALL how to move an object of any sort in any direction. Help? And while you're at it if you know of any core animation tutorials other than apple documentation that would be great. Thanks!
 

Cromulent

macrumors 604
Oct 2, 2006
6,813
1,100
The Land of Hope and Glory
I'm working on learning core animation right now, though it's hard since everything I find is complicated demonstrations and not tutorials. Anyways, I'm doing well enough, but I want to know how to move an object on all three axis. I can't figure out AT ALL how to move an object of any sort in any direction. Help? And while you're at it if you know of any core animation tutorials other than apple documentation that would be great. Thanks!

Your probably looking in the wrong places. This is more of a maths question rather than a programming question. What have you tried?

Edit : Here you go:

http://developer.apple.com/document...nimation_guide/Introduction/Introduction.html

All you need.

Edit 2 : And this is the specific page which deals with exactly what you are looking for.

http://developer.apple.com/document...es/Layers.html#//apple_ref/doc/uid/TP40006082
 

liptonlover

macrumors 6502a
Original poster
Mar 13, 2008
989
0
thanks!
And what I had found was CGPoint, but I have no clue how to use it so I googled it, and I still couldn't find anything helpful. Thanks again!
 

Cromulent

macrumors 604
Oct 2, 2006
6,813
1,100
The Land of Hope and Glory

liptonlover

macrumors 6502a
Original poster
Mar 13, 2008
989
0
ok that brings me to hopefully my final question. How do I set up a new "instance" of a struct and use it? I don't have much experience with structs, all I did was read about how to use them. I know what they do and all that and I can use one in plain C but not in concert with cocoa/obj-c.
Thanks again for your help and all these links!
 

lucasgladding

macrumors 6502
Feb 16, 2007
319
1
Waterloo, Ontario
Code:
CGPoint point;
point.x = 100;
point.y = 100;

Structs work like integers or floats. They don't work like classes. Your best bet is to look at some of the drawing examples that ship with Xcode.

BTW: I responded to your post yesterday and included the link to the new Pragmatic Programmers book about Core Animation.

Best of luck
 

liptonlover

macrumors 6502a
Original poster
Mar 13, 2008
989
0
ok so the code you just posted will create a CGPoint called point, with x and y values both equaling 100 right?
Now how do I use those points? I can't find a function like [[layer animator]location:point];
or anything like that.
Finally, what about zlocation? Is that just a third field in the struct? Can I just do point.z=[];?
 

Cromulent

macrumors 604
Oct 2, 2006
6,813
1,100
The Land of Hope and Glory
ok so the code you just posted will create a CGPoint called point, with x and y values both equaling 100 right?
Now how do I use those points? I can't find a function like [[layer animator]location:point];
or anything like that.
Finally, what about zlocation? Is that just a third field in the struct? Can I just do point.z=[];?

No, read the reference for CGPoint. It is for 2D only.

I posted the reference material that explained what you need to do. It is maths you need to do, so you need to translate the objects using the functions in one of the links I posted above.
 

liptonlover

macrumors 6502a
Original poster
Mar 13, 2008
989
0
Sorry forgot about the links you gave me. I gotta go now but I'll read through them tomorrow.

I'm kind of curious though... why is math involved in translating that CGPoint into movement of an object? I don't get why you said that at all... :confused:
 

Cromulent

macrumors 604
Oct 2, 2006
6,813
1,100
The Land of Hope and Glory
I'm kind of curious though... why is math involved in translating that CGPoint into movement of an object? I don't get why you said that at all... :confused:

Because anything to do with 3D in programming is just trigonometry, matrices and vectors basically.

Yes, maths does have some uses - wish I had paid more attention in my school maths lessons now when I was younger but there you go, hindsight and all that.
 

liptonlover

macrumors 6502a
Original poster
Mar 13, 2008
989
0
I know programming involves loads of math usually, but don't forget core data is 2.5D not 3D :p and it certainly isn't involved in what I want to do right now.
 

liptonlover

macrumors 6502a
Original poster
Mar 13, 2008
989
0
you're just full of links aren't you :D
Well now that I can stick around I'm going to read the appl doc before asking another question..... maybe. Questions are just such a nicer and easier way to learn for me :rolleyes:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.