quartz composition

Please share your functions/code-snips

quartz composition

Postby udo.killermann » Sat Jun 02, 2012 1:18 pm


I was playing around with Quartz Composer (found in the Developer Tools) recently and trying to get it work with Obj B. In a book I was reading, the author stated you can use Quartz composition as visualization to enrich the user interface. But with QCViewer you have the ability to control the composition via your program:

Code: Select all
Event AwakeFromNib()
'  Log(theQCView.loadCompositionFromFile("/Users/HU/Desktop/ObjectiveBasic/quartz composition/helloWorld2.qtz"))
  Log(theQCView.loadCompositionFromFile(NSBundle.ResourcePath() & "/helloWorld2.qtz"))
  theQCComposition = theQCView.loadedComposition()
 Log(theQCView.setValue(LightGrayColor, forInputKey := "backColor"))
 Log(theQCView.setValue(NSBundle.ResourcePath() & "/humble bee.JPG", forInputKey := "imageLocation"))
  theQCView.setValue(theYKnob.SingleValue, forInputKey := "yRotation")
  theQCView.setValue(theXKnob.SingleValue, forInputKey := "xRotation")
  theQCView.setValue(theZKnob.SingleValue, forInputKey := "zRotation") 
End Event

The result looks like this:
clock.jpg (38.96 KiB) Viewed 1195 times

It's not static, but really ticking away the seconds while you watch it (so give it a run on your computer). Behind the digits you can see a background image shining through. You can easily change this to something more suitable for you by modifying the imageLocation key. If you move the dials you can tilt the digits around x-,y- and z-axis respectively.

Here comes the project:
(1.99 MiB) Downloaded 158 times

The heavy lifting is done in helloWorld2.qtz, which looks like this in Quartz Composer:
composerFlow.jpg (66.36 KiB) Viewed 1195 times

I would like to read from you if it works on your computer as well.

MacBook (2GHz, 4 GByte) - Lion (10.7.3)
started Objective Basic coding in April 2010 - still enjoy it ;-)
Posts: 247
Joined: Thu Apr 08, 2010 6:46 am
Location: Hannover, Germany

Return to Code examples

Who is online

Users browsing this forum: No registered users and 1 guest