Hello! My name is Petyr. I cannot realize the effects of a button appearance. I would like the button (“tap to continue…”) to appear slowly with the “fade” effect. The button is on the modal scene and not belongs to the scene group.
I have attached the photo for clarity.
Thanks!
@Peter, please show us your code. Remember to use the <> button in the control bar make your code display as code.
local function gotoscenepause() -- go to the modal scene where my button is local options = -- (You can ignore it) { isModal = true, effect = "slideLeft", time = 450, } composer.showOverlay( "pause\_scene" , options ) end local function onstopBtnRelease() gotoscenepause() return true end -- below is a modal scene script -- theres a lot of unnecessary there, so I left the code associated with my button local composer = require( "composer" ) local scene = composer.newScene() local widget = require "widget" widget.setTheme("widget\_theme\_android") local continuebutton local function oncontinueBtnRelease() local options = { effect = "fade", time = 350, } composer.hideOverlay("pause\_scene", options) return true -- indicates successful touch end function scene:create( event ) local sceneGroup = self.view local other = display.newGroup() continuebutton = widget.newButton { label = "tap to continue...", font="Helvetica", width=(height2-(height2-(height2/2.5)))+30, height=width2, onRelease = oncontinueBtnRelease -- event listener function } continuebutton.x = (height2-(height2-(height2/2.5)))/2+20 continuebutton.y = width2/2 other:insert( continuebutton ) end function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then elseif phase == "did" then end end function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then elseif phase == "did" then end end function scene:destroy( event ) local sceneGroup = self.view if continuebutton then continuebutton:removeSelf() -- widgets must be manually removed continuebutton = nil composer.removeScene('pause\_scene') end end --------------------------------------------------------------------------------- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) ----------------------------------------------------------------------------------------- return scene
Sorry for the wait.
Hi Petyr, just to clarify, you are asking how to get your “continuebutton” to fade in? If so, I see that it is in a group called “other” so maybe . . .
[lua]
other.alpha = 0
transition.to( other, {time = 1000, alpha = 1} )
[/lua]
Is that what you were asking?
So this is what I needed. You helped a lot Mr. sporkfin. Thank you very much!