Press "Enter" to skip to content

Day Night Wallpaper Engine

My little brother bought Wallpaper Engine from Steam, I take a look and trying to make one Live Wallpaper that involve Day Night live cycle.

Wallpaper Engine support scripting, which is make Wallpaper more robust and more advanced! Here, I share what I made

Open your project

Either you create or edit existing, both works, just need your first layer (background) to manipulate.

Add or select first layer which is most background, background must be Night/Black
Add new effect “Blend” and click Edit
Select “Day” background and drop into Textures
Blend Mode: Normal, and Edit Script under Multiply

When you under Code Editor/Script, paste this code and clock “OK”

'use strict';

/**
 * @param {Number} value (for property 'multiply')
 */
export function update(value) {
	var t = engine.timeOfDay;

	if (t <= 0.5) {
		return t * 2;
	}
	else {
		return Math.abs(mod((t * 2) * 10, -10) * 0.1);
	}

	return t;
}

function mod(n, m) {
	return ((n % m) + m) % m;
}

What these code does, it use engine.timeOfDay; value and make it bounce from 0 to 1 to 0, I made simulation on Excel, pretty handy!

As you can see, Live is engine.timeOfDay; which is start from 0 until 1 (23:59:59), the code make it bounce back when engine.timeOfDay; reach value 0.5

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.