Creating a radar sweep effect
Creating a radar sweep effect
- Subject: Creating a radar sweep effect
- From: John Cebasek <email@hidden>
- Date: Sat, 26 Sep 2009 21:19:03 -0400
Hi All:
I'm wondering what the best way to create a radar sweep effect is?
(Like in old war movies?)
I was trying to create a shadow effect but that didn't look good as
when the sweep line was at 0, 90, 180 or 270 degrees, the shadow
wasn't very visible. And even using the shadow, it wasn't long enough
with the values I tried. And I had tried afew.
I then tried the following:
CGContextStrokeEllipseInRect(context, squareRect);
//
// Draw the sweep
//
CGContextBeginPath(context);
CGContextSetLineWidth(context, 1.65);
// CGContextMoveToPoint(context, centerPoint.x, centerPoint.y);
CGContextSetRGBFillColor(context, 0.0, 1.0, 0.0, 1.0);
CGColorRef color = CGColorCreate(CGColorSpaceCreateDeviceRGB(),
shadowColor);
CGContextSetShadowWithColor(context,
CGSizeMake(-2.0, 2.0),
5.0,
color);
CGColorRelease(color);
viewCoordinates[0] = centerPoint;
viewCoordinates[1] = [self
convertToViewCoordinatesFromPolarAngle:nDegree
withRadius:radius];
viewCoordinates[2] = [self convertToViewCoordinatesFromPolarAngle:
(nDegree - 5)
withRadius:radius];
CGContextAddLines(context, viewCoordinates, 3);
CGContextClosePath(context);
CGContextSetFillColorWithColor(context, [UIColor greenColor].CGColor);
CGContextStrokePath(context);
In this code I was trying to get the triangle to be filled with a
green colour, but that didn't work. But at least there's a triangle
that is drawn where it should bet. (And yes I have read the various
documentation, but nothing's jumped out as to what to use).
Can someone point me to a URL, sample code or make a (polite)
suggestion?
Thanks in advance for your time
John
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden