Screen Melt Plugin for Corona
About the Plugin
The Screen Melt Plugin for Corona extends Corona's built-in Composer library with a scene transition effect inspired by id Software's classic DOOM. If you've ever played the original DOOM, you'll instantly recognize the effect:
Adding the Plugin to your App
- Activate the plugin at the Corona Marketplace
- Add an entry into the plugins table of your project's build.settings file. Below is an example of a minimal build.settings file with the required entry for the progressRing plugin:
settings = {}
settings.plugins = {
['plugin.screenMelt'] = {publisherId = 'com.schroederapps'},
}
Requiring the plugin
To enable the "screenMelt" transition effect, simply require
the plugin into your app, preferably early on in your main.lua
:
require('plugin.screenMelt')
Now, simply pass in the string screenMelt
where you'd normally indicate the transition effect you want to use when calling composer.gotoScene()
. There are 2 different ways you can do this:
composer.gotoScene('someScene', 'screenMelt')
composer.gotoScene('someScene', {effect = 'screenMelt'})
Customizations
By default, using the screenMelt transition effect will result in a 1 second (1000ms) melt effect, with the screen divided up into 320 vertical "slices" of equal width. This is in keeping with the original DOOM, which as far as I could tell split up a VGA screen (640 pixels wide) into 2-pixel slices.
If desired, you can specify the speed of the transition by including a time
parameter in the options
table of your composer.gotoScene()
call:
composer.gotoScene('someScene', {effect = 'screenMelt', time = 2000})
Likewise, you can specify the width of the vertical "slices" in Corona content units by including a sliceWidth
parameter in the options
table of your composer.gotoScene()
call:
composer.gotoScene('someScene', {effect = 'screenMelt', sliceWidth = 66.6})
Gotchas
- Only visual objects on the OpenGL canvas will be "melted" in this effect. Native display objects like text fields or web views will remain in place "on top of" the melt effect. Please take this into consideration when using this effect on scenes that utilize native objects.
- The plugin utilizes a number of screen capture APIs in rapid succession to achieve the vertical slicing of the image. On modern mobile devices, this should be nearly instantaneous, but on older, less-capable devices, there may be noticeable lag. You may be able to improve performance by setting a larger
sliceWidth
, thereby reducing the number of screen capture operations being performed. - Should go without saying, but I'm in no way affiliated with id Software or DOOM. I'm just a fan. :)