Hi Chris,
If you’re still reading this,
how exactly do you do the ‘snapshot -> effect -> transition -> dispose’ you mentioned in your last entry?
Are you able to do this without flickering?
regard, Johannes
Hi Chris,
If you’re still reading this,
how exactly do you do the ‘snapshot -> effect -> transition -> dispose’ you mentioned in your last entry?
Are you able to do this without flickering?
regard, Johannes
It is actually easier to “not” use snapshot and just load the image from a file using newImage but regardless of how you do it it is pretty simple.
create a new image (from file, imagesheet or snapshot)
call transition.to(object.fill.effect, {params for fill.effect, onComplete = function()
timer.performWithDelay(1, function()
//dispose of object or do whatever you want after it finishes the transition.
end, 1)
end})
Not sure what you mean about flickering, do you mean flickering between images? If so there are a ton of tricks you can do to avoid the “visual” flicker.
If you don’t need to take a snap shot (because of imagesheets) then simple revert the effect back to normal using the same process of transition.to but in reverse.
You only need to do this kind of thing on certain types of transitions/fill effects like blur, rotation etc. the reason for this is because all they are really doing on a imagesheet when you do new image is masking off everything except your x/y/w/h values so “most” of the time it isn’t a big deal like with fillColor etc. and so forth.
Thanks Chris,
I’d like to dynamically add a glow effect on whatever display object I want with as little prerequists as possible.
This includes groups: I want to be able to painlessly add a glow effect on a group, even when a project is in it’s end phase, when I don’t want to rebuild graphics or rearrange things into snapshots.
All solutions I came up with are unsatisfying, probably I’m missing something.
First thing I tried, was to just exchange the a given group with the group of a snapshot object, later invalidate->effect.
This doesn’t work well, because all local coordinate transformations also have to be touched (parent/ localToContent/etc is different then).
And, as you stated, I would always appr. double the memory usage for these elements for all times. So this is not a solution.
The other obvious thing I tried was to insert the group into a dynamically created snapshot -> invalidate -> do effect -> reinsert group where it was -> discard snapshot.
But this solutution flickered. Perhaps I did something wrong, that’s why I was asking if you have a working (and leightweight) solution for that.
display.capture is also somewhat unusable because it doesn’t always work (elements have to be on screen. why?)
Walter, in case of you also still following this:
What would have been wrong about just giving us a function
render2obj( display.obj ) -> display object / fill object.
like display.capture, just usable. This is what we really need: a working, robust, fast display.capture.
I don’t get the whole point of snapshots: given we had said function, what would we need snapshots for.
I get that corona wants to give us something that’s used like a group with the properties of a single texture. This would have been ok, if and only if groups and snapshots would habe been mutually exchangable, but they aren’t
Or am I getting something horribly wrong?
Johannes,
I think you are over thinking this and given “what i understand about your post” off the top of my head you have a few options.
1: Particle Effects
Just from what you explain above I would guess you could use particles to create a glow effect and then just resizing, modifying on the fly depending on what object I was wanting to create the effect with.
There are a few options you can use to achieve what you are looking for if you are on a mac you can use particle editor/designer and use coronas built in support for particle effects or particle candy is another good choice that is what I actually use as I haven’t had any time to mess around with particle editor or the build in stuff that corona has now.
2: Image Sheets (with a glow image for each image you want to have a glow effect.)
This one requires some advanced knowledge of something like photoshop but what you can do is have your base image and then have another image that is the glow effect.
The idea being is you place both images in a group glow first and then game image, then you can use stuff like add/multiply,alpha and misc other effects on the “glow” image to achieve the desired effect.
Because they would all be in the same imagesheet you would not take any kind of extra performance or memory hit because the entire imagesheet would already be loaded up.
Unless of course I am not fully understanding what it is you are trying to do
Granted I haven’t had my first cup of cafe so I am a little out of it at the moment
Oh, sorry, I was a little inconcise. And ‘glow’ was perhaps misleading.
I just want to be able to use the corona filter effects on arbitrary display objects (that is groups).
I picture the following process for that
- render a group of objects to a temporary texture
- obtain a temporary display object texured with that texture
- exchange the original group with that display object to…
- do some corona filter effects with it
- and then discard the temporal stuff and show the original group
This process has to be robust and such that I don’t have to take any preparations for it, so that any time I could write
local tmp = render2texture( group )
transition.to( tmp.fil, {…})
I just haven’t found any acceptable solution for exactly this in corona, but there probably is a way