我正在尝试使用A-Frame
添加Javascript
个元素,但不会工作。
我需要一个for循环来添加一堆盒子。
//Starting variables
var sceneEl = document.getElementsByTagName('a-scene')[0];
var pathLength = 8;
// path
for (var i = -1; i => -pathLength; i--) {
//wood
var woodPathEl = document.createElement('a-box');
woodPathEl.setAttribute("position", "0 -1 " + i);
woodPathEl.setAttribute("src", "#wood");
sceneEl.appendChild(woodPathEl);
// grass
var grassPathEl = document.createElement('a-box');
grassPathEl.setAttribute("position", '-1 -1 ' + i);
grassPathEl.setAtrribute("src", '#grass');
sceneEl.appendChild(grassPathEl);
}
答案 0 :(得分:0)
虽然循环方法对我来说似乎有些不同寻常,但我认为真正的问题在于package com.test;
import java.io.RandomAccessFile;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
public class MappedFileGarbage {
public static void main(String[] args) throws Exception {
RandomAccessFile raf = new RandomAccessFile("blah.bin", "rw");
MappedByteBuffer mbf = raf.getChannel().map(FileChannel.MapMode.READ_WRITE,0,100*8L);
mbf.putInt(1000).putInt(2000).putDouble(4000.0);
raf.close();
raf = new RandomAccessFile("blah.bin", "rw");
mbf = raf.getChannel().map(FileChannel.MapMode.READ_WRITE,0,100*8L);
dump(mbf);
}
private static void dump(MappedByteBuffer mbf){
// Reading the data without manually setting the position, as getXXX(n) methods internally increment the position.
System.out.println(mbf.getInt(0));
System.out.println(mbf.getInt(4));
System.out.println(mbf.getDouble(8));
// Reading the data via getXXX() method as manually setting the position, as getXXX(n) methods don't increment the position.
System.out.println(mbf.position());
System.out.println(mbf.getInt());
System.out.println(mbf.position(4));
System.out.println(mbf.getInt());
System.out.println(mbf.position(8));
System.out.println(mbf.getDouble());
System.out.println(mbf.position());
}
}
。您希望将=>
用于“大于或等于”。 >=
用于ES6中的箭头功能分配,这是一种完全不同的动物。