I have started experimenting with creating snaplenses. Apart from learning for myself, I though it would be cool to share some useful / fun effects and timesavers for other lens creators! For more cool and advanced stuff, check out my brother’s website MaxvanLeeuwen.com
Typewriter effect

// -----JS CODE----- //@ui {"widget":"label", "label":"Keyboard settings"} //@ui {"widget":"separator"} //@ui {"widget":"label", "label":""} //@ui {"widget":"label", "label":"Typewriter v3.5"} //@ui {"widget":"label", "label":"Luuk van Leeuwen"} //@ui {"widget":"label", "label":"LuukvanLeeuwen.nl/contact"} //@ui {"widget":"label", "label":""} // @input Component.Text textComponent //Text component to edit // @input string finalText //Text it should become // @input float wait = 0.1 //Time interval between every letter // @input bool OnlyStartIfEmpty = false //Could prevent effect to start again mid-sentence // @input Component.AudioComponent playSound StartTyping(); //The typing starts whenever the script is called. Remove this line if you don't want that! function StartTyping() { if((script.OnlyStartIfEmpty == true && script.textComponent.text =="")|| script.OnlyStartIfEmpty == false) { if(script.playSound!=null) script.playSound.play(-1); i = 0; //CAN THE PLAYER CUSTOMIZE THE TEXT USING MAX VAN LEEUWEN'S KEYBOARD? ADD THIS LINE: //script.finalText = global.KeyboardResult(1); //Change () to wanted textlayer script.textComponent.text = ""; DelayedFunction(AddLetterToText,script.wait); script.timesCalled ++; } } var IsPausing; function AddLetterToText() { if(IsPausing){ if(script.playSound!=null) { IsPausing = false; script.playSound.play(-1); } } if(i<script.finalText.length) { script.textComponent.text = script.textComponent.text + script.finalText.charAt(i); // Adds a letter to the final string text if(script.finalText.charAt(i) != "." && script.finalText.charAt(i) != "," && script.finalText.charAt(i) != "!"&& script.finalText.charAt(i) != "?") { if(script.playSound!=null) script.playSound.resume; DelayedFunction(AddLetterToText,script.wait);//Calls this function again in x seconds to add the other character or to finish. } else{DelayedFunction(AddLetterToText,(1)); if(script.playSound!=null) { script.playSound.play(0); IsPausing = true; } } i++; //Adds numer to I so it knows it did another character } else { DoneTyping(); } } function DoneTyping() { if(script.playSound!=null) script.playSound.play(0); //Will be called if typing is finished } function DelayedFunction (func, time) { var CallbackEvent = script.createEvent("DelayedCallbackEvent"); CallbackEvent.bind(func); CallbackEvent.reset(time); }