Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How can I make a pie timer? I need to be able to draw a circular arc with dynamically changing angles.
Started by gains Nov 30 2014 01:33 PM

- - - - -
33 replies to this topic
[TOPIC CONTROLS]
Page 2 of 2 1 2
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Contributor

  • 469 posts
  • Corona SDK

Hi Krystian,

 

Unfortunately the method I use relied exclusively on Corona's vector display objects (newCircle, newRect, newPolygon, etc.), which are not aliased (at least not yet). So if you need a softer edge, then I think your own workaround is probably the better bet, at least for now. 

 

I took a look, and I couldn't find a feature request for anti-aliased vector objects. It's probably worth making a request and trying to drum up some votes for it (I'd throw a couple votes at it). You can make a new request here: http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback 

 

Thanks,

Jason



[TOPIC: post.html]
#27

krystian6

[GLOBAL: userInfoPane.html]
krystian6
  • Contributor

  • 560 posts
  • Corona SDK

[TOPIC: post.html]
#28

krystian6

[GLOBAL: userInfoPane.html]
krystian6
  • Contributor

  • 560 posts
  • Corona SDK

BTW...

 

As an easy workaround for aliasing of vector graphics on corona, I used to create an object 3-4 times larger and scale it down.

It worked quite ok for me back when I needed it for some testing.



[TOPIC: post.html]
#29

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Contributor

  • 469 posts
  • Corona SDK

I could be wrong, but I was under the impression that anti-aliasing was removed a year or two ago and has not come back since. There is the option for changing the OpenGL Rendering mode to "linear" or "nearest neighbor," but that only impacts images loaded from file, not vector objects. Here's the request for that feature, and notes from David Rangel on its implementation (the request is marked as "completed"): http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/3574881-nearest-neighbor-opengl-rendering-mode 



[TOPIC: post.html]
#30

yosu

[GLOBAL: userInfoPane.html]
yosu
  • Contributor

  • 541 posts
  • Corona SDK

I notice that the chart 'bleeds out' at the bottom on the iPad (iOS7).

 

Do you know why ? See the screenshot.



[TOPIC: post.html]
#31

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Contributor

  • 469 posts
  • Corona SDK

This is likely related to the dynamic masking method I employ, which still has a few kinks that present themselves in certain situations. Try reducing the radius a bit and see if you still get the same issue at all radius values. This didn't happen for me on my iPad Air back when I created the module, but perhaps you're on an iPad 2? I don't have one of those, so I'm unable to test directly.

 

I hope to nail down a solid fix that will "always work" for generating dynamic masks. Once I do, I'll be sure to update the module. Sorry it wasn't as smooth as it should be for you!



[TOPIC: post.html]
#32

yosu

[GLOBAL: userInfoPane.html]
yosu
  • Contributor

  • 541 posts
  • Corona SDK

Hi,

 

Ya. I am on iPad mini with the retina display (either iPad2 or 3).

 

I tried to adjust the values, but they are still the same. Pls see the screenshots.

 

 

Thanks



[TOPIC: post.html]
#33

davebollinger

[GLOBAL: userInfoPane.html]
davebollinger
  • Corona Geek

  • 1,373 posts
  • Corona SDK

for what it's worth, and with no intent to diminish the cleverness of Jason's existing solution, you can get around all this mucking about with masks by just creating a bunch of "wedges" (ok, technically isosceles trapezoids) between the inner and outer radii along the chords at whatever degree of segmenting you want to chop up the circle.  (or even just rectangles - slightly different look, but one you've seen before)

 

if you segment up the circle fine enough, the discreteness is indistinguishable from continuous.  see attached top left-most instance where finely segmented, compare with 3rd on top row where more coarsely segmented.  (others are just additional instances of same class with varying segmentation, radii, thickness, etc)

 

if as you're creating each "tick mark" you give it a ratio property (fe, i'm number 7 of 100, or 0.07) then it's really easy to toggle on/off just the ones you need for an indicated degree of progress.  (also easy to do a "trail" where the tail follows along at "progress-0.25" or such, instead of staying stuck at 0, like if used as an indeterminate "busy" indicator rather than strict linear progress)

 

fwiw, hth



[TOPIC: post.html]
#34

chkuendig

[GLOBAL: userInfoPane.html]
chkuendig
  • Observer

  • 8 posts
  • Corona SDK

@horacebury

 

Thanks for your elegant solution. I found a minor issue with it: Sometimes the ring doesn't go all the way to the end (i = 360).

 

Manually calling render() one last time in the onComplete-Function solves this problem.




[topic_controls]
Page 2 of 2 1 2
 
[/topic_controls]