Task : To animate arc with alpha, scaling pulse
I have done almost everything using this Code : "https://github.com/booncol/Pulsator4Droid/blob/master/pulsator4droid/src/main/java/pl/bclogic/pulsator4droid/library/PulsatorLayout.java"
The only change I want to do instead of full circle I want half of it only arc would be great. But this drawn shape should be from bottom to top and placed horizontally on view.
I have searched half of the Internet for implementing this silly thing but
my drawn arc or circle is either like : "(" or ")" I want this curved shape to be facing top like in Some outgoing radiation type.
Have a refference from this link
https://github.com/DevLight-Mobile-Agency/PulseView
This will generate a wave from your icon's shape..
So i believe, for semi-circle wave, the requirement will be a semicircle icon .
Related
I'm trying to draw some text on path using the canvas in Android. I can successfully get the text to draw on the top oval line. What i'm struggling to do is make sure that the text is centered.
The problem is that while i can measure the text before it gets drawn round the top line of the oval, i cannot measure it after. This makes estimating where the text should be drawn on the top oval line problematic as it's always a little bit out. This is because when i measure the text to be drawn initially it is measured in a straight line and not as presented on the top line of the oval.
I've tried applying setTextAlign(Paint.Align.CENTER) but this makes the text get drawn about 3/4's of the way round and not what i want.
Does anyone have any ideas how i could calculate the point to draw the text so it is drawn dead centre of the top oval line or any alternative method that may help?
This has to be drawn using the canvas. It can't be done using XML TextViews etc.
Thanks.
You can check how this library done it: https://github.com/amulyakhare/TextDrawable
Its using the same approach. But for multiple lines its almost impossible, theres an issue on this library where me and other developers tried to implement it, and we end up using just xml (a round drawable as a linearLayout view background and one textView inside it).
I am experimenting with Views in Android and am trying to create a custom 'widget'. What I want to do is create a portion of a circle with an indicator at 12'o clock. I'd then like to to swipe over the circle and when I do, I'd like to see the indicator move to left or right corresponding to a swipe to the left or the right.
I have looked up a number of sources however I am unsure of how to draw an 'indicator' within the arc. In addtion, what needs to be done to animate the arc ? Can this be achieved without OpenGL ?
I am aware of the circlular progress bar and I believe the problem is quite similar, however I didn't have to add a marker inside the circle.
Here is an image of the screen shot of the View I would like to recreate:
This approach would work,Creating a View with rounded corners and position it to bottom to make it seem like arc
I want to apply the border to this custom view shape
which created by many canvas.draw...() in onDraw()
The border that i want to create and apply to my custom view should have equal range all the way with some distance from the custom view and it should also cover small circle in each slice.
Any idea how to make this?
Thanks.
This isn't so much an answer, but more of a recommendation. Take a look at the Porter-Duff modes available to you. Worst case you may need to do some per pixel image manipulation which should be fine as long as the view isn't animated.
On second thought, here's an idea: why not create two images: one large circle which will always draw behind everything and a second which will always draw behind the small circles. The large circle would just be the complete border you want displayed, whereas the small circles would actually only be a semi circle border, which would render on top of the large circle (covering the large circle border under it). The key would then be to rotate the small border circle depending on where it's located. I hippie that makes sense, but it should work and be very efficient too.
Another option would be to separate the rendering into white circles and slightly larger border color circles. If you render the slightly larger (border color) circles first, then render the normal circles (white) on top, then you won't have to worry about any rotations and it will render correctly if the small outer circles begin to overlap.
So the idea is similar to the first suggestion. You'll still need a large circle and small circle (both white), but in addition, you'll need slightly larger border colored large and small circles.
I hope this description is a little clearer, but I assume that you are comfortable enough with compound drawables to figure out the rest, given that you've gotten this far in making your view.
All the best implementing it, and feel free to ask for any clarification! :)
I need to create the painting application for the kids where kid can colour inside the black bordered sketch of any image
But, I am struck with the problem,that colouring can come outside the black bordering of the image...which i don't want to.Please guys help me to find out how to restrict the colouring by user within the black border of sketch
Also, I want that no colour should cover the black border.it should be inside the border.
I can post my code if required.
Look at Canvas clipPath and use the clipping built in to android to limit the 'coloring' of the kid/user to the regions you specify. You can then draw your objects as layers, kid/user colored layer on bottom, your sketch on top.
Finally..i have implemented it using mask bitmap and right usage of Portet.Duff mode
Animation:
All the animations on the Android books I read are made on an existing image. They load an image on the SD card and use animation functions (like alpha, scale, translate and rotate) to make it move. However, what if I want to make the shapes I drew move on the screen. For example, I just draw a circle on the screen and want to make it move from left to right. How can I do this?
Painting:
Functions like drawCircle can draw complete geometric shapes but I just want to draw part of a shape, for example, a 3/4 solid circle. How should I do? If I use drawArc, there will be a 'V' recess on the circle and I want it to be flat.