/**
 *
 * @param {Vector3} Vec3 出现位置
 */

export function checkAnimation(Vec3 = new this.THREE.Vector3(), size = 0.3) {
  // 先清空group
  if (this.group) {
    if (Vec3.x === this.group.position.x && Vec3.z === this.group.position.z) {
      return;
    }
    this.scene.remove(this.group);
  }

  // 创建一个group
  this.group = new this.THREE.Group();
  //  创建一个圆柱
  const cylinder = new this.THREE.CylinderGeometry(0.5, 0.5, 3, 32);
  const material = new this.THREE.MeshBasicMaterial({ color: "#0dbc79" });
  const cylinderMesh = new this.THREE.Mesh(cylinder, material);
  const header = new this.THREE.CylinderGeometry(1, 0.1, 3, 32);
  const headerMesh = new this.THREE.Mesh(header, material);
  headerMesh.position.set(0, -3, 0);
  this.group.add(cylinderMesh, headerMesh);
  this.group.position.set(Vec3.x, Vec3.y + 2, Vec3.z);

  //   创建动画
  this.checkAnimationTween = new this.TWEEN.Tween(this.group.position);
  this.checkAnimationTween.to({ y: this.group.position.y + 1 }, 500);
  //   循环动画
  this.checkAnimationTween.repeat(Infinity);
  this.checkAnimationTween.yoyo(true);
  this.checkAnimationTween.start();
  this.group.scale.set(size, size, size);
  this.scene.add(this.group);
}
