Change external module parameters

Hi guys,

I am playing with Jason’s progressRing (progress pie).
How can I update it’s parameters on the fly without creating new ring?
For example ringColor parameter?

Thanks.
Ivan

local ringObject = progressRing.new({
radius = 200,
bgColor = {1, 0, 0, 1},
ringColor = {0, 1, 0, 1},
ringDepth = .33,
time = 4000,
})

http://www.jasonschroeder.com/2014/12/21/progress-ring-module-for-corona-sdk/

Hi Ivan,

Thanks for using the module! As written, there is no method for changing the colors on a progressRing object. But you can certainly add methods that would allow this. I’m a bit swamped at the moment, so I don’t have the time to make the changes myself anytime especially soon. But I do have plans to revamp the code in the future to make it a little more robust (and to fix issues that can arise when you’re using dynamic content scaling that make the auto-mask creation fail in certain circumstances). I’ll add this to the “wish list” for when I finally crank out that update one of these days. :slight_smile:

Thanks Jason for a quick reply :slight_smile:
Its a great module!!!

I will just display.remove progressRing and create a new one.

Ivan

Hi Jason,

One last question please!  :smiley:

I noticed when running my app on iPad Mini 2 , that ringColor “gets out” of the ring diameter on about 135 degrees position.

I use clockwise spin, and subject problem is NOT present on Android phones.

This problem can be solved by using masks I am not mistaken?

My ringColor alpha is always 1.

“Each progress ring object utilizes two masks that are created on-the-fly, through code. One is to create the “donut hole” effect, and the other is to mask the movement of the ring “slices” as they appear from a zero position. Corona has a nested masking limit of 3, so take care when inserting your progress ring into other masked objects, such as display containers, to make sure you don’t exceed that limit.”

I WILL TRY THIS SOLUTION ON MY IPAD  :smiley:

local mask = graphics.newMask( "circlemask.png" ) local ringObject = progressRing.new({ radius = 200, bgColor = {1, 0, 0, 1}, ringColor = {0, 1, 0, 1}, ringDepth = .33, time = 4000, }) ringObject:setMask( mask )

I will use Dynamically-Selected Mask and let you know the results!

Many thanks!

Ivan

Hi Ivan,

Yes - what you are experiencing are the issues I was referring to before - if you’re targeting multiple device resolutions, the auto-generated masks can sometimes come out not meeting the strict “divisible by 4” criteria for masks. If you pre-make your own mask files and load them (you’d need to modify the code to do this but it shouldn’t be too hard), then this should fix things for you. This is something that I’d like to fix in an update, to make the module more usable in a variety of situations.

Thanks! :slight_smile:

Hi Jason,

If:

  •  ring radius parameter is 60 pixels

  •  image radius parameter is 80 pixels (so image is larger than the ring)

I should make:

- mask.png width = 160 pixels (i.e. mask.png diameter = 160 pixels, if it is a circle shape)

Am I right?

Thanks!   :smiley:

Ivan

One last question!

Will I need to modify code in your .lua module?
Or just modify my code?

Thanks.
Ivan

Hi Ivan,

The most important thing is that you make your mask image conform to the rules laid out here: https://docs.coronalabs.com/daily/guide/media/imageMask/index.html

You’ll also need to modify the module, to skip the “auto-mask” creation and to apply your mask to the display group that gets returned as the progressRing object.

Hi Jason,

Many thanks for your support!

I think that I will skip progressRing this time.

Reason is, when you look at it on the iPad mini 2, you se that ringColor is imperfect (i.e. you see one or two little gray lines - I think that are the pixels not colored).

Module is great, but I will choose Sprite for now.

Many, many thanks!  :slight_smile:

Ivan

Hi Ivan,

Thanks for using the module! As written, there is no method for changing the colors on a progressRing object. But you can certainly add methods that would allow this. I’m a bit swamped at the moment, so I don’t have the time to make the changes myself anytime especially soon. But I do have plans to revamp the code in the future to make it a little more robust (and to fix issues that can arise when you’re using dynamic content scaling that make the auto-mask creation fail in certain circumstances). I’ll add this to the “wish list” for when I finally crank out that update one of these days. :slight_smile:

Thanks Jason for a quick reply :slight_smile:
Its a great module!!!

I will just display.remove progressRing and create a new one.

Ivan

Hi Jason,

One last question please!  :smiley:

I noticed when running my app on iPad Mini 2 , that ringColor “gets out” of the ring diameter on about 135 degrees position.

I use clockwise spin, and subject problem is NOT present on Android phones.

This problem can be solved by using masks I am not mistaken?

My ringColor alpha is always 1.

“Each progress ring object utilizes two masks that are created on-the-fly, through code. One is to create the “donut hole” effect, and the other is to mask the movement of the ring “slices” as they appear from a zero position. Corona has a nested masking limit of 3, so take care when inserting your progress ring into other masked objects, such as display containers, to make sure you don’t exceed that limit.”

I WILL TRY THIS SOLUTION ON MY IPAD  :smiley:

local mask = graphics.newMask( "circlemask.png" ) local ringObject = progressRing.new({ radius = 200, bgColor = {1, 0, 0, 1}, ringColor = {0, 1, 0, 1}, ringDepth = .33, time = 4000, }) ringObject:setMask( mask )

I will use Dynamically-Selected Mask and let you know the results!

Many thanks!

Ivan

Hi Ivan,

Yes - what you are experiencing are the issues I was referring to before - if you’re targeting multiple device resolutions, the auto-generated masks can sometimes come out not meeting the strict “divisible by 4” criteria for masks. If you pre-make your own mask files and load them (you’d need to modify the code to do this but it shouldn’t be too hard), then this should fix things for you. This is something that I’d like to fix in an update, to make the module more usable in a variety of situations.

Thanks! :slight_smile:

Hi Jason,

If:

  •  ring radius parameter is 60 pixels

  •  image radius parameter is 80 pixels (so image is larger than the ring)

I should make:

- mask.png width = 160 pixels (i.e. mask.png diameter = 160 pixels, if it is a circle shape)

Am I right?

Thanks!   :smiley:

Ivan

One last question!

Will I need to modify code in your .lua module?
Or just modify my code?

Thanks.
Ivan

Hi Ivan,

The most important thing is that you make your mask image conform to the rules laid out here: https://docs.coronalabs.com/daily/guide/media/imageMask/index.html

You’ll also need to modify the module, to skip the “auto-mask” creation and to apply your mask to the display group that gets returned as the progressRing object.

Hi Jason,

Many thanks for your support!

I think that I will skip progressRing this time.

Reason is, when you look at it on the iPad mini 2, you se that ringColor is imperfect (i.e. you see one or two little gray lines - I think that are the pixels not colored).

Module is great, but I will choose Sprite for now.

Many, many thanks!  :slight_smile:

Ivan