Skip to content

Instantly share code, notes, and snippets.

@Anime4000
Created December 26, 2019 15:32
Show Gist options
  • Save Anime4000/f5c8df8f4cd1af58caf2d73b14a4974e to your computer and use it in GitHub Desktop.
Save Anime4000/f5c8df8f4cd1af58caf2d73b14a4974e to your computer and use it in GitHub Desktop.
Day Night Wallpaper Engine
'use strict';
import * as WEMath from 'WEMath';
/**
* @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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment