Created
January 24, 2020 03:05
-
-
Save rbkavin/9f79af097ea592de764adfb1fcf7619c to your computer and use it in GitHub Desktop.
spark random colour generator for par material
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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