Re: NSView setFrameSize
Re: NSView setFrameSize
- Subject: Re: NSView setFrameSize
- From: "I. Savant" <email@hidden>
- Date: Wed, 25 Jan 2006 11:03:56 -0500
What is the earliest version you want to support? As I said,
NSViewAnimation is exactly suited to this, but it's 10.4 only. You
give it the before frame and the after frame, an animation type, the
duration, and tell it to run. Boom. Done. ;-)
Otherwise, you can achieve this effect with an NSTimer (as John
Styles mentioned in his reply). The way you visualize this is as
follows:
If you want the right side to be anchored and the left side to
grow toward the left, you need to not only resize the view on each
animation step but move it over to the left by the amount you resized
it. This is because the x axis' zero point is on the left side.
In other words, if at each step of your animation, you grow the
view's width by 5 pixels, you need to also adjust the view's origin
by -5 pixels.
You might also want to read more about views, drawing, and the
coordinate system as it sounds suspiciously like you haven't had a
good intro to the coordinate system itself. :-)
--
I.S.
On Jan 25, 2006, at 10:47 AM, haym37 wrote:
Hi,
Thanks for your quick reply. I am merely resizing an NSView; I am
not resizing anything within it. When I change the width of this
NSView, it expands it from the left to the right. When i = 5,
let's say the point of the top-right corner of the NSView will be
20 and the point of the top-left corner will be 10, but then when i
= 25, the point of the top-right corner will be 40, and the point
of the top-left corner will remain 10. I want it so that the point
of the top-left corner is the one that moves and the top-right
remains the same. Therefore, if the point of the top-right corner
starts at 25 and the top-left corner is 20 when i = 5, when i = 25
the top-right corner will remain at 25, but the top-left corner
will become 0.
On Jan 25, 2006, at 10:36 AM, I. Savant wrote:
Hello:
For one thing, it's a bad idea to put this into a tight loop.
NSViewAnimation would be more suited for this purpose. A tight
loop will tie up your UI and possibly display the beachball -- a
really poor user experience.
I'm having a hard time visualizing exactly what you intend to
display, but it seems to me it'd be a lot easier just to swap
individual images (with the individual numbers in them) if you're
just doing a countdown type animation.
If this isn't the case, could you provide a more specific
description of the effect you're trying to accomplish?
--
I.S.
On Jan 25, 2006, at 10:28 AM, haym37 wrote:
Suppose that I had an NSView, with an image in it the same size
of the NSView. Now, I start the NSView with a width of 0. I
want to animate this image opening, so I have a for loop, pause
in it for about 5 milliseconds, and set the frame size
(setFrameSize) of the NSView to be i (i increments each time).
Now, this slowly "opens up" to the right. For instance, if my
image just had the numbers "1, 2, 3, 4, 5" from left to right, it
would slowly show "1" then "2" then "3", etc. But, I want it to
"open up" to the left, so that it first shows "5" then "4" then
"3", etc. How would I do this? Any help would be greatly
appreciated. Thanks!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden