pretty self expanatory, flickering lights, lights that turn on an off at a random time
flickering lights
how do you do that in playcanvas
Hi @Deadshot1m24,
Here is one way to do it using the PlayCanvas tween library:
var FlickeringLights = pc.createScript('flickeringLights');
FlickeringLights.prototype.initialize = function() {
this.lightIntensity = {value: 1};
this.entity.tween(this.lightIntensity)
.to({ value: 2 }, pc.math.random(0.5, 1.0), pc.ElasticIn)
.on("update", (dt) => {
this.entity.light.intensity = this.lightIntensity.value;
})
.yoyo(true)
.loop(true)
.start();
};
And a sample project:
https://playcanvas.com/editor/scene/1386370
2 Likes
Here is a random light script I made. It has a few script attributes that can be changed.
3 Likes
your script is quite nice but i dont require it i dont need to put in the extra work to get a quite similar result, i am happy with what i have now but thanks for the help
working quite well

1 Like
the issue with that one is it doesn’t really randomize, but loops.