Skip to content

Instantly share code, notes, and snippets.

@rbkavin
Created January 24, 2020 03:05
Show Gist options
  • Save rbkavin/9f79af097ea592de764adfb1fcf7619c to your computer and use it in GitHub Desktop.
Save rbkavin/9f79af097ea592de764adfb1fcf7619c to your computer and use it in GitHub Desktop.
spark random colour generator for par material
const m = require('Materials');
const s = require('Scene');
const t = require("TouchGestures");
const r = require("Reactive");
const d = require("Diagnostics");
var min =0;
var max =1;
function ran(){
return Math.random() * (max - min) + min ;
}
t.onTap(s.root.find("Heart")).subscribe(()=>{
var a1=ran();
var a2=ran();
var a3=ran();
var color = r.RGBA(a1,a2,a3,1);
d.log(a1+" "+a2+" "+a3);
m.get("Heart_mat").baseColorFactor=color;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment