Created
February 28, 2015 13:41
-
-
Save baba-s/6088b77a225cc8a6da4b to your computer and use it in GitHub Desktop.
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
| UnityEngine = luanet.UnityEngine | |
| System = luanet.System | |
| gameObject = UnityEngine.GameObject | |
| vector3 = UnityEngine.Vector3 | |
| quaternion = UnityEngine.Quaternion | |
| color = UnityEngine.Color | |
| time = UnityEngine.Time | |
| primitiveType = UnityEngine.PrimitiveType; | |
| abs = System.Math.Abs | |
| sin = System.Math.Sin | |
| sqrt = System.Math.Sqrt | |
| if cube == nil then | |
| cube = gameObject.CreatePrimitive( primitiveType.Cube ) | |
| end | |
| function update( dt ) | |
| t = time.realtimeSinceStartup | |
| y = sin( t ) | |
| a = sin( 1 + 3 * t ) | |
| r = abs( sin( 2 + 1.5 * t ) ) | |
| g = abs( sin( 3 + 1.6 * t ) ) | |
| b = sqrt( 1 - r * r - g * g ) | |
| cube.transform.position = vector3( 0, y, -5 ) | |
| cube.transform.rotation = quaternion.AngleAxis( 60 * t, vector3( a, 1, 0 ) ) | |
| cube.renderer.material.color = color( r, g, b ) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment