LoginSignup
1
0

More than 1 year has passed since last update.

paiza.ioでelixir その135

Posted at

概要

paiza.ioでelixirやってみた。
練習問題やってみた。

練習問題

ブロックを積め。

サンプルコード



IO.puts """
<!doctype html>
<html>
  <head>
    <script src="https://rawgithub.com/nosir/obelisk.js/master/build/obelisk.js" type="text/javascript"></script>
  </head>
  <body>
    <textarea id="src">
"""
IO.puts """
    p(1, 1, 1)
    p(1, 1, 2)
    p(1, 1, 3)
"""
IO.puts """
</textarea>
    <canvas id="canvas" width="300" height="300"></canvas>
    <script>
var canvas = document.getElementById('canvas');
var point = new obelisk.Point(200, 200);
var pixelView = new obelisk.PixelView(canvas, point);
var src = document.getElementById('src');
eval(src.value);
function p(x, y, z) {
  var p3d = new obelisk.Point3D(30 * x, 30 * y, (32 + 1) * z);
    var cubeDms = new obelisk.CubeDimension(30, 30, 32);
    var cubeColor = new obelisk.CubeColor().getByHorizontalColor(obelisk.ColorPattern.getRandomComfortableColor());
    var cube = new obelisk.Cube(cubeDms, cubeColor, false);
    this.pixelView.renderObject(cube, p3d);
}
    </script>    
  </body>
</html>
"""





成果物

以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0