Skip to main content

📜 [Script] Count Up Script & Count Down Script | Print many Days left | Lens Studio

📜 [Script] Count Up Script & Count Down Script | Print many Days left | Lens Studio Count UP Script - (Prints How many days left from given Date eg. Day 360)   // -----JS CODE----- //@input int startDateDay //@input int startDateMonth //@input int startDateYear // For 3D Text only change Component.Text to Component.Text3D //@input Component.Text countUpText // Component.Text works for Both "Text Object" & "Screen Text" startDateDay = script.startDateDay startDateMonth = script.startDateMonth startDateYear = script.startDateYear var startDate = new Date (startDateYear, startDateMonth - 1 , startDateDay); var today = new Date (); var timeDiff = Math .abs(today.getTime() - startDate.getTime()); var daysDiff = Math .ceil(timeDiff / ( 1000 * 3600 * 24 )); if (script.countUpText) { script.countUpText.text = "Day " + daysDiff; } Count Down Script - (Print What is the current day to give...

📜 [Script] Count Up Script & Count Down Script | Print many Days left | Lens Studio

📜 [Script] Count Up Script & Count Down Script | Print many Days left | Lens Studio

Count UP Script - (Prints How many days left from given Date eg. Day 360)

 
// -----JS CODE-----
//@input int startDateDay
//@input int startDateMonth
//@input int startDateYear

// For 3D Text only change Component.Text to Component.Text3D
//@input Component.Text countUpText
// Component.Text works for Both "Text Object" & "Screen Text"

startDateDay = script.startDateDay
startDateMonth = script.startDateMonth
startDateYear = script.startDateYear

var startDate = new Date(startDateYear, startDateMonth - 1, startDateDay);
var today = new Date();

var timeDiff = Math.abs(today.getTime() - startDate.getTime());
var daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));

if (script.countUpText) {
    script.countUpText.text = "Day " + daysDiff;
}

Count Down Script - (Print What is the current day to given Date eg. Day 2)

// -----JS CODE-----
//@input int endDateDay
//@input int endDateMonth
//@input int endDateYear

// For 3D Text only change Component.Text to Component.Text3D
//@input Component.Text countDownText
// Component.Text works for Both "Text Object" & "Screen Text"

endDateDay = script.endDateDay;
endDateMonth = script.endDateMonth;
endDateYear = script.endDateYear;

var endDate = new Date(endDateYear, endDateMonth - 1, endDateDay);
var today = new Date();

var timeDiff = Math.abs(endDate.getTime() - today.getTime());
var daysDiff = Math.floor(timeDiff / (1000 * 3600 * 24)) + 1;

if (script.countDownText) {
script.countDownText.text = "Day " + daysDiff;
}


Comments

Popular posts from this blog

📜 [Script] Tap / Touch Change Scene Object Script | Lens Studio

  📜 [Script] Tap / Touch Change Scene Object Script  Steps to use:- Create Scene Object Add Script Component Create Script In Resource Panel & Rename it as TouchScript Add TouchScript to Scene Object Script Copy Paste this Script & Save Use:- Change multiple objects on touch. Create Empty Scene Object. Add Your Object 1 and Empty Object 2 to perform On / Off on Tap. Change Multiple text on Touch. Change Multiple Image Component on Touch. Change Multiple 2d / 3d object on Touch. Script:- Change Scene Objects on Tap Ready to use Script // Change Scene Objects on Tap Script // @input SceneObject[] items // Arrays are indexed from 0. // Disable everything but the first (0th) item . for ( var i = 1 ; i < script.items.length; i++) { script.items[i].enabled = false ; } // We remember what item is currently visible. // When we start it's the 0th item. var currentItemIndex = 0 ; // Define what happens when you tap. function activateNe...

📜 [Script] Tap / Touch Change Only Image Script | Lens Studio

  📜 [Script] Tap / Touch Change Only Image Script Script:- Change Image on Tap Steps to use:- Create Scene Object Add Script Component Create Script In Resource Panel & Rename it as TouchImageScript Add TouchImageScript to Scene Object Script Copy Paste this Script & Save Add Single Image Component to the Script in Background Add Series of Images to the Script Use:- Change multiple Images on touch. Change Multiple Image on Screen Text Object. No need to Create Multiple Image Component.   // Change Image On Tap // @input Component.Image background // @input Asset.Texture[] images var index = 0 ; script.background.mainPass.baseTex = script.images[index]; script.createEvent( "TapEvent" ).bind( function () { index += 1 ; if (index >= script.images.length) { index = 0 ; } script.background.mainPass.baseTex = script.images[index]; print( "Tap" ); });