Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying transitions between screens #103

Closed
baochungit opened this issue Jan 4, 2024 · 2 comments
Closed

Applying transitions between screens #103

baochungit opened this issue Jan 4, 2024 · 2 comments

Comments

@baochungit
Copy link

I have 2 screens, each screen (collection) has many game objects on it. I want to switch between screens with a fade-in transition. Looking at the example I see that it seems the transitions only work on GUI nodes however screens in my knowledge are not only for GUI stuff. So can we have transition effects on the whole screen rather than GUI component?

(Sorry but I don't know a place for this kind of question. Feel free to close it if not suitable)

@britzl
Copy link
Owner

britzl commented Jan 4, 2024

Hi @baochungit. Sure, you can do whatever you wish in your transition code. The examples and predefined transitions work on GUI nodes, but you can do anything in the transition.

monarch.on_transition("myscreen", function(message_id, message, sender)
	if message_id == monarch.TRANSITION.SHOW_IN then
		local to = 0
		local duration = 1.5
		local delay = 0
		-- animate tint.w (ie alpha to 0)
		go.animate("go#sprite", "tint.w", go.PLAYBACK_ONCE_FORWARD, to, go.EASING_INOUTQUAD, duration, delay, function()
			msg.post(sender, monarch.TRANSITION.DONE)
		end)
	end
end)

@baochungit
Copy link
Author

Great to know that! At least I see it more flexible in usage. Thanks!

@britzl britzl closed this as completed Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants