Your Hype Snippets


#1

Post your Hype code snippets here in the following format:

Button To Text

function buttonToText(hypeDocument,element,event){	
	var name = element.innerHTML;
	
	if (name){
	hypeDocument.getElementById('text').innerHTML = name;
	hypeDocument.startTimelineNamed('Main Timeline');}
}

Description

This code sets an element with the id of text to the text of the button/element that calls this function and additionally plays a timeline.

Instructions

No further instructions.

Demo(s)

buttonToText.zip (480.2 KB)
buttonToParagraph.zip (36.2 KB)

Please post one snippet per post. Also, please make them plug-n-play.


#2

Good Idea. However, may I suggest a “use case scenario”. RE your example, I’m not sure how helpful it would be. Also a bit more info on “plug and play”. You have supplied a document, export and template. Maybe a little overkill. I would suggest maybe packaging up in a symbol that way when added to a project it would inject the functions into it on import.

P.S I’ll delete this post once looked at so as not to cloud the topic.


#3

Yes. The first example was a bit much. The second is only the hype document. Good idea with the symbol too. Use case can be added under the description section.


(Mark Hunte) #4

I have switched this to the Meta category ,

As it is about how to post on the site and is not a tip or trick in relation to Hype.app in of itself.