Re: Rotation in CAAnimation layers
I do this with a CAAnimation layer myLayer: myLayer.shadowOffset = CGSizeMake( 5.0, 5.0 ); and get a shadow on the upper and right edges. But when I rotate the layer 180 degrees, the shadow then appears on the lower and left edges. Real shadows don't do that. If the object were circular, I'd just put another stationary layer underneath and attach the shadow to it. But with other shapes this won't work. So finally, my question: Is there an easy way of calculating the position and appearance of the shadow for non-circular shapes? (By easy I mean one that I can just copy from somewhere.) If not I'll try to figure it out myself; but I don't want to re-invent the wheel. dkj On 24 Oct, 2008, at 18:11, douglas welton wrote: On Oct 24, 2008, at 6:50 PM, DKJ wrote: Is there an easy way to provide a realistic shadow for a (non- circular) layer rotating round the z-axis? (I know layer.rotateShadow = YES is too much to hope for.) To get a realistic answer, it might help if you provide a little more specific information about 1) what you are trying to do, 2) what is not working and 3) what you have tried. (consult: http://www.catb.org/~esr/faqs/smart-questions.html ) regards, douglas Hatzic Intellectual Software Victoria BC, Canada www.hatzicware.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Rotation in CAAnimation layers
On Oct 25, 2008, at 8:31 AM, DKJ wrote: I do this with a CAAnimation layer myLayer: myLayer.shadowOffset = CGSizeMake( 5.0, 5.0 ); and get a shadow on the upper and right edges. But when I rotate the layer 180 degrees, the shadow then appears on the lower and left edges. Real shadows don't do that. If the object were circular, I'd just put another stationary layer underneath and attach the shadow to it. But with other shapes this won't work. So finally, my question: Is there an easy way of calculating the position and appearance of the shadow for non-circular shapes? (By easy I mean one that I can just copy from somewhere.) If not I'll try to figure it out myself; but I don't want to re-invent the wheel. It sounds like you want a fixed shadow position regardless of rotation. Note that whenever you apply a rotation (or transformation for that matter), shadow offsets are also adjusted accordingly. Whenever you rotate your layers, you'll need to re-calculate your shadow offsets accordingly. Also, there may exist an API to allow for shadows to be fixed? Not sure about that. Wouldn't be a bad enhancement to file though. ___ Ricky A. Sharp mailto:[EMAIL PROTECTED] Instant Interactive(tm) http://www.instantinteractive.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Rotation in CAAnimation layers
do the following: grab your polaroid camera (I'm old school). go outside. find a sundial. take a picture. note the direction/appearance of the real shadow. turn the photograph upside down.* shadows belong to the layer, so if you rotate the layer, you also rotate the shadow - you do not change the position of the light source. The shape of your drawing in the layer is not relevant! If you want the shadow to simulate your light source staying in the same place, then animate the shadow offset at the same time as you rotate the layer. something like this might work: targetLayer.shadowOffset = normalOffset; targetLayer.affineTransform = normalAffineTransform; ... [CATransaction begin]; targetLayer.shadowOffset = newOffsetBy180Degrees; targetLayer.affineTransform = newAffineTransformRotatedBy180Degrees; [CATransactioncommit]; Note: typed in e-mail... ymmv regards, douglas *sell camera on ebay for $20. sell upside-down polaroid at Christie's for millions and retire ;^} On Oct 25, 2008, at 9:31 AM, DKJ wrote: I do this with a CAAnimation layer myLayer: myLayer.shadowOffset = CGSizeMake( 5.0, 5.0 ); and get a shadow on the upper and right edges. But when I rotate the layer 180 degrees, the shadow then appears on the lower and left edges. Real shadows don't do that. If the object were circular, I'd just put another stationary layer underneath and attach the shadow to it. But with other shapes this won't work. So finally, my question: Is there an easy way of calculating the position and appearance of the shadow for non-circular shapes? (By easy I mean one that I can just copy from somewhere.) If not I'll try to figure it out myself; but I don't want to re-invent the wheel. dkj On 24 Oct, 2008, at 18:11, douglas welton wrote: On Oct 24, 2008, at 6:50 PM, DKJ wrote: Is there an easy way to provide a realistic shadow for a (non- circular) layer rotating round the z-axis? (I know layer.rotateShadow = YES is too much to hope for.) To get a realistic answer, it might help if you provide a little more specific information about 1) what you are trying to do, 2) what is not working and 3) what you have tried. (consult: http://www.catb.org/~esr/faqs/smart-questions.html ) regards, douglas Hatzic Intellectual Software Victoria BC, Canada www.hatzicware.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Rotation in CAAnimation layers
Is there an easy way to provide a realistic shadow for a (non- circular) layer rotating round the z-axis? (I know layer.rotateShadow = YES is too much to hope for.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Rotation in CAAnimation layers
On Oct 24, 2008, at 6:50 PM, DKJ wrote: Is there an easy way to provide a realistic shadow for a (non- circular) layer rotating round the z-axis? (I know layer.rotateShadow = YES is too much to hope for.) To get a realistic answer, it might help if you provide a little more specific information about 1) what you are trying to do, 2) what is not working and 3) what you have tried. (consult: http://www.catb.org/~esr/faqs/smart-questions.html ) regards, douglas ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]