Animate (pulse, glow) CPTPlotSymbol using Core Plot - ios

I would like to animate (pulse, glow) the following plot symbol. What is the best way to achieve the desired behavior. Thanks

You cannot animate a plot symbol. What you can do is put a plot space annotation over the highlighted point. Make a custom CPTLayer subclass that draws your symbol shape and use that for the annotation's content layer. Animate the symbol layer using standard Core Animation methods.

I'm not sure about glowing but, I do that there is a method(that I can't seem to recall) that you can call that will do just that! It's like CGResize or something, it exists! Don't lose hope. Sorry i'm not able to help more.
Actually for glowing you could animate it with animationImages = [NSArray arrayWithObjects: then the picture you want to glow just make it dark to bright then bright to dark, then setAnimationRepeatCount:0 to it'll repeat! This way is a bit verbose but it'd work! Best of luck :]

Related

How can I animate the drawing of a complex line shape in objective-c

So say I wanted to animate drawing this shape:
Animate it something like the disney logo which seems to "write" the letters.
Ideally, I'd also like to have control over how fast it was drawn (maybe just easing), how would I go about getting that done? Specifically imagine if that link had a line of varying widths.
Not too familiar with drawing things in objective-c so perhaps someone can help point me in the right direction in terms of strategy.
Create a CAShapeLayer and set that shape as its path. Use a CABasicAnimation or a CAKeyframeAnimation to animate its strokeEnd property.

Animate color of stroke's ends using CGPath

Quick diagrams! I'm trying to implement this:
I have this working almost 100% currently (though this is a slightly different stage of the animation):
Everything looks good minus the fade effects at the end of the stroke. Is that possible using a simple CGPath? I'm animating strokeStart and strokeEnd to get the current effect. I've tried using CAGradientLayer as a mask on the layer, but that adds a gradient over the entire layer, not just the ends. Overriding drawRect isn't possible since I'm doing this dynamically with animations.
Any thoughts about how to achieve this effect? I have no idea which direction to go.
Depending on how important opacity is and how complex the rest of the animation is, one option would be to make two blurred tail objects that follow the ends of the path as it is animating.
Roundabout solution, sorry I can't think of another versatile way!

UISlider - draw line / image to the track (bar)

I have UISlider with min and max track colors. I want to draw vertical line (or image) in the middle of the slider track. This line must be there the whole time, only color on top of it will be different (min / max track color).
If I put UIImage on the Slider background, tracks covers it. If I set clear color for tracks, I can see line, but no colors from tracks (obviously). Is there any simple way, how to do this, or I have to override drawRect method for Slider ?
Something like on the slider in image
Note that the sort of "ultimate" solution to this type of project is...
http://www.paintcodeapp.com
As #BradAllred pointed out, the fundamental problem here is: you are trying to avoid drawRect.
Realistically, you can only achieve your goal here by subclassing UIControl or slider.
As others have mentioned fortunately there are many great tutorials, etc, on doing this -- and it's not hard.
Once again paintcodeapp.com is kind of an "incredible secret" to making iOS apps, enjoy.
add an UIView that is 1 pixel wide and has the height of the Slider and put it over the slider.
Create a CALayer, draw it, (even add an image to it), then add that layer as a sublayer to the Slider's layer.contents.

Adding border to edges of opaque area of UIImage with a filter

Hello: Currently in my project, I'm using OBShapedButton to process touches on a lot of objects that overlap (it's a map with each territory its own separate object). Basically, this library prevents a touch from being processed on a transparent point on the given view.
I'm attempting to add a border effect to just the edges of the opaque part of the UIImage (and adding a semi-transparent overlay above that). Something to the effect of this:
Which can be simplified to this (example of one image):
I am currently using MGImageUtilities to color in the opaque parts of territories using this line:
[territory setImage:[[territory image] imageTintedWithColor:tint]];
The problem is that I'm not sure how to just color the borders (which can be any shape). I've looked at this link already, but haven't been able to come up with anything.
Thanks in advance for the help!
Terribly hacky, but use MGImageUtilities' UIImage+ProportionalFill with scale resizing to create a slightly larger image, UIImage+Tint to red, and stack below.
The library you are using doesn't actually specify a shape layer. It uses alpha values from the PNGs that you give it.
Could you use a different 'highlighted' or 'selected' PNG that adds the border effect you are looking for?
Otherwise, it you will have to generate a UIBezierPath from your PNG image, which sounds like a very computationally intensive operation. At that point, I might question whether this library meets your needs.

XNA dropshadow?

How can I make a dropshadow effect around a rectangle that I made out of primitives (line-strips) in XNA? I am currently making my rectangle by putting the primitives through a batch I made, and then adding textures as their background. These rectangles are supposed to symbolize "windows".
I want them to have a cool drop shadow as well.
Any good suggestions?
easiest way? first render your object as a black silhouette, slightly offset in the opposite direction of your light source. Then when you render your object on top of it, you will have a nice little drop shadow. This is a very simple and low effort technique.
Exaclty what Joel Martinez said, also you can add transparency to shadow if you are using AlphaBlend:
spriteBatch.Draw(texture, location, Color.Black * 0.5f);

Resources