local Q=require("\114\097\121\108\105\098")local z,p=800,450 Q.SetConfigFlags(Q.FLAG_VSYNC_HINT)Q.InitWindow(z,p,"\114\097\121\108\105\098 \091\109\111\100\101\108\115\093 \101\120\097\109\112\108\101 - \119\097\118\105\110\103 \099\117\098\101\115")local U=Q.Camera3D(Q.Vector3(30,20,30),Q.Vector3(0,0,0),Q.Vector3(0,1,0),70,Q.CAMERA_PERSPECTIVE)local j=15 while not Q.WindowShouldClose()do local z=Q.GetTime()local p=(2.0+math.sin(z))*.7 local W=z*.3 U.position.x=math.cos(W)*40.0 U.position.z=math.sin(W)*40.0 Q.BeginDrawing()Q.ClearBackground(Q.RAYWHITE)Q.BeginMode3D(U)Q.DrawGrid(10,5.0)for U=0,j-1,1 do for W=0,j-1,1 do for K=0,j-1,1 do local m=((U+W)+K)/30 local h=math.sin(m*20.0+z*4.0)local b=Q.Vector3((U-j/2)*(p*3.0)+h,(W-j/2)*(p*2.0)+h,(K-j/2)*(p*3.0)+h)local t=Q.ColorFromHSV((((U+W)+K)*18)%360,.75,.9)local c=(2.4-p)*m Q.DrawCube(b,c,c,c,t)end end end Q.EndMode3D()Q.DrawFPS(10,10)Q.EndDrawing()end Q.CloseWindow()
--[[
  Contributed by Codecat (@codecat)
  Reviewed by Ramon Santamaria (@raysan5)

  Modified by Teddy Astie (@TSnake41) for Lua binding.
  Modified by James Doyle (@james2doyle) for Luajit binding.
]]

local rl = require("raylib")

local width, height = 800, 450

rl.SetConfigFlags(rl.FLAG_VSYNC_HINT)

rl.InitWindow(width, height, "raylib [models] example - waving cubes")

local camera = rl.Camera3D(rl.Vector3(30, 20, 30), rl.Vector3(0, 0, 0), rl.Vector3(0, 1, 0), 70, rl.CAMERA_PERSPECTIVE)

local num_blocks = 15

while not rl.WindowShouldClose() do
  local t = rl.GetTime()

  local scale = (2.0 + math.sin(t)) * 0.7
  local camera_time = t * 0.3

  camera.position.x = math.cos(camera_time) * 40.0
  camera.position.z = math.sin(camera_time) * 40.0

  rl.BeginDrawing()
  rl.ClearBackground(rl.RAYWHITE)

  rl.BeginMode3D(camera)
  rl.DrawGrid(10, 5.0)

  for x = 0, num_blocks - 1 do
    for y = 0, num_blocks - 1 do
      for z = 0, num_blocks - 1 do
        local block_scale = (x + y + z) / 30
        local scatter = math.sin(block_scale * 20.0 + t * 4.0)

        local cube_pos = rl.Vector3(
          (x - num_blocks / 2) * (scale * 3.0) + scatter,
          (y - num_blocks / 2) * (scale * 2.0) + scatter,
          (z - num_blocks / 2) * (scale * 3.0) + scatter
        )

        local cube_color = rl.ColorFromHSV((((x + y + z) * 18) % 360), 0.75, 0.9)

        local cube_size = (2.4 - scale) * block_scale

        rl.DrawCube(cube_pos, cube_size, cube_size, cube_size, cube_color)
      end
    end
  end

  rl.EndMode3D()
  rl.DrawFPS(10, 10)

  rl.EndDrawing()
end

rl.CloseWindow()
