Skip to content

Instantly share code, notes, and snippets.

@SamGondelman
Created September 22, 2017 20:26
Show Gist options
  • Save SamGondelman/760eb062444763ce34b1f51ff349573f to your computer and use it in GitHub Desktop.
Save SamGondelman/760eb062444763ce34b1f51ff349573f to your computer and use it in GitHub Desktop.
"use strict";
// LineAlphaTest.js
//
// Created by Sam Gondelman on 9/22/2017
// Copyright 2017 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
(function() { // BEGIN LOCAL_SCOPE
var lines = []
var NUM_LINES = 100.0;
for (var i = 0; i < NUM_LINES; i++) {
lines.push(Overlays.addOverlay("line3d", {
start: Vec3.sum(Vec3.sum(Vec3.sum(MyAvatar.position, Vec3.multiply(4.0, Vec3.FRONT)), Vec3.multiply(-0.5, Vec3.RIGHT)), Vec3.multiply(i * 0.01, Vec3.UP)),
end: Vec3.sum(Vec3.sum(Vec3.sum(MyAvatar.position, Vec3.multiply(4.0, Vec3.FRONT)), Vec3.multiply(0.5, Vec3.RIGHT)), Vec3.multiply(i * 0.01, Vec3.UP)),
color: {red: 255, green: 0, blue: 0},
visible: true,
alpha: i / NUM_LINES,
solid: true,
glow: 1.0
}
));
}
function cleanup() {
for (var i = 0; i < NUM_LINES; i++) {
Overlays.deleteOverlay(lines[i]);
}
}
Script.scriptEnding.connect(cleanup);
}()); // END LOCAL_SCOPE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment