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

Animation of TextInput prompt #1734

Open
mlapido opened this issue May 31, 2018 · 5 comments
Open

Animation of TextInput prompt #1734

mlapido opened this issue May 31, 2018 · 5 comments
Labels

Comments

@mlapido
Copy link

mlapido commented May 31, 2018

Josh,

This is not so much an issue but a question/request for a suggestion. I would like to animate the TextInput's prompt text to move to the upper left corner of the component and keep it there, as a label, whenever there is content in there. Can you please tell me how should I go about it?

@joshtynjala joshtynjala changed the title Animation of InputText prompt Animation of TextInput prompt May 31, 2018
@joshtynjala
Copy link
Member

I don't have a good suggestion for you. If you're okay with simply repositioning the prompt without animation, you could probably extend TextInput and override layoutChildren() to position the prompt differently if hasFocus is true. Something like this:

override protected function layoutChildren():void
{
	super.layoutChildren();
	if(hasFocus && prompt != null)
	{
		//reposition the prompt here
	}
}

Getting it to work with animation might be tricky, though.

Another option might be to create a LayoutGroup with a TextInput and Label as children. Use the Label instead of the prompt, and you'll have full control over it without affecting the layout inside of the TextInput.

@mlapido
Copy link
Author

mlapido commented Jun 1, 2018

Thanks, Josh! I think the second option will suit me better. I'll try it and let you know. But, correct me if I'm wrong, you have been adding some animation abilities to feathers, what are those about?

@joshtynjala
Copy link
Member

Yeah, I've added some new ways that you can tell a Feathers component to animate some kind of change to its state. For instance, when the visible property is set to true or false (showEffect/hideEffect), when a component is added or removed from the display list (addedEffect and removeFromParentWithEffect()), when a component receives or loses focus (focusInEffect/focusOutEffect), or when a component is resized or repositioned (resizeEffect/moveEffect).

Additionally, the List component can add animation to an item being added or removed from the data provider (addItemWithEffect() and removeItemWithEffect()).

@mlapido
Copy link
Author

mlapido commented Jun 12, 2018

Cool, Josh, do you have any example of those effects working?

@joshtynjala
Copy link
Member

I'm still working on the supporting documentation, examples, and things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants