konva react sdk, fade out all drawn line - konvajs

I have a requirement to fade out all lines drawn after a fixed delay.
I followed the simple drawing example.
The code sandbox is available in the following url.
https://konvajs.org/docs/react/Free_Drawing.html
Please advise.

Related

I want to use PencilKit to draw perfectly shaped shapes. What should I do?

Using Apple's own photo album, when editing photos, I used the Apple Pencil to draw blurred red paths, keeping and then creating perfect circles.
I looked at the API for PencilKit and found that Apple does not provide one. But I want to implement drawing in my application and keep creating the perfect shape. How do I do that?
Shape recognition is a private API. Only Apple's app can use it. My suggestion would be: Check last stroke in the canvasViewDrawingDidChange(), then check with your algorithmen which shape it is, then create a beautiful PKStroke and replace the last stroke.

Smooth free hand drawing brush in iOS swift?

In trying to develop an drawing app, where i can able draw line, circle and letter, etc. But drawn lines are not in smooth. Is there any sdk or library for variety of brush for smooth drawing.
Here is my screenshot of drawn lines
Any help will be greatly appreciated! Thanks in advance!!!

How to make speech bubble (callout) on SpriteKit iOS?

I'm creating a game for children using SpriteKit framework in iOS.
In my game, there are many speech bubbles which should be drawn by code.
I googled around and found intructions about using SKShapeNode to do it, but I haven't found a full Objective-C source code.
Has anyone done this before?
You can use the speech bubble you have already posted and display it as a SKSpriteNode with texture or image. Depending on your code set limitations, you can scale the y-axis for more or less text lines. Add SKLabelNodes to the bubble as children.

How do I achieve Yahoo Weather ScrollView Effect?

I'm really interested in creating a UIScrollView similar to the Yahoo Weather app. Here's an example on video:
http://www.youtube.com/watch?v=a-q_yetkpik
I have found this Git which will alow me to do the fade background thing:
https://github.com/justinmfischer/core-background
But how would I achieve the blur effect at the top so that as content scrolls up, it almost fades out behind the UINavigationBar
Any help would be appreciated!!
I wrote the code for the UI effects in the Yahoo! Weather app, would be happy to answer your question.
Sounds like you've figured out how to do the blur (fade between a blurred image based on pixel offset, maxing out at a certain amount... for even better effect, you can have multiple steps in the blur - i.e. fade between non-blurred to half-blurred, then half-blurred to full-blurred etc).
For the fading under kind of effect, you can set the mask property on your content view's layer:
https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/CALayer_class/Introduction/Introduction.html#//apple_ref/occ/instp/CALayer/mask
The mask is an image that fades from transparent to opaque.
--Iain.
I am probably a little late for the party but I have an example project that does exactly that. I did try to look through Yahoo! app for the said image mask Iain was talking about. I have yet to be able to use it the way he described. So I created a CALayer on the fly to achieve the effect.
(#Iain, awesome job! big fan)
Here is the GitHub link
I haven't personally tried it but this might be a good start: https://github.com/kronik/DKLiveBlur
DKLiveBlur
Sources of DKLiveBlur and Demo app to show live blur effect similar to yahoo weather iOS app.
I achieved a similar effect using FXBlurView:
https://github.com/nicklockwood/FXBlurView
You simply set the blurRadius relative to the amount scrolled: scrollView.contentOffset.y
Thanks to Iain for pointing out CALayer masks.
Download the sample code for blur from Evan Davis blog.

Pattern fill that "follows" the path?

On iOS, I'm using core-plot to draw a line graph. I want the line to be bordered top and bottom with a solid color and a different color in the middle, a striping effect. This cannot be done using CPTLineStyle, so I created a custom line style that uses CGContextSetStrokePattern to draw the line.
I thought I achieve the desired effect by creating a striped image and using it as the stroke pattern. This works, but the image orientation does not follow the direction of the path. The stripes are always horizontal even if the direction of the path is 45 degrees.
How can I tell Quartz auto rotate the pattern fill such that it follows the vector direction of the graph segment? Or alternatively, how can I get core-plot to do this for me?
We recently added the lineGradient property to CPTLineStyle that gives you a very flexible way to do this. See the "Gradient Scatter Plot" demo in the Plot Gallery example app.
Note that this change was added after the 1.3 release and is not part of a downloadable release yet. You will need to pull the latest code with Mercurial to get the change or wait for the next release.
The best solution I've found is to use two plots. The first with the wider line style the second with the narrower one. That achieves the desired effect.

Resources