Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Hand positions in a circle
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
--lua 5.3 print ("Hello, World!") local colors = {"Blue", "Brown", "Green", "Orange", "Pink", "Purple", "Red", "Teal", "White", "Yellow"} local heading = 18 --initial heading. We're going clockwise from the top-most point, so 90+(36/2) local sin = math.sin local cos = math.cos local rad = math.rad local radius = 50 local positions = {} for k,v in ipairs(colors) do positions[v] = { x = sin(rad(heading))*radius, z = cos(rad(heading))*radius, h = heading, } heading = heading + 36 end for k,v in pairs(positions) do local str = [[ { "Color": "]]..k..[[", "Transform": { "posX": ]]..v.x..[[, "posY": 3.5, "posZ": ]]..v.z..[[, "rotX": 0.0, "rotY": ]]..(v.h+180)..[[, "rotZ": 0.0, "scaleX": 16.0, "scaleY": 10.0, "scaleZ": 8.0 } }, ]] print(str) end local
[
+
]
Show input
edit mode
|
history
|
discussion