Skip to content

Instantly share code, notes, and snippets.

import * as THREE from 'three'
/**
* See: https://github.com/maximeq/three-js-capsule-geometry
*/
export class CapsuleGeometry extends THREE.BufferGeometry {
constructor(
radiusTop,
radiusBottom,
height,
@ashconnell
ashconnell / CrosshairGeometry.js
Created December 6, 2021 13:07
A simple crosshair buffer geometry for three.js
import { BufferGeometry, Vector3 } from 'three'
export class CrosshairGeometry extends BufferGeometry {
constructor(thickness = 0.5) {
super()
const t = thickness
const points = [
[-5, t, 0],
[5, -t, 0],
[5, t, 0],
@ashconnell
ashconnell / _imageModal.scss
Last active August 29, 2015 14:20
Image Viewer/Modal
.image-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 150;
opacity: 1;
transition: opacity .15s ease;
overflow: hidden;
@ashconnell
ashconnell / example.js
Created April 20, 2015 22:13
Ionic: manipulate history stack
/*
* This example shows how to control the history stack.
* Say if we went A->B->C and then when pressing back, you want it to go to A (skip B)
*/
// Reference current history set
var viewHistory = $ionicHistory.viewHistory();
var history = viewHistory.histories[viewHistory.currentView.historyId];
// Remove both B and C
@ashconnell
ashconnell / csDropdown.js
Created December 9, 2013 00:46
AngularJS Directive for drop-down menus. - Outside clicks close open menus - Opening another menu, closes all other menu's.
app.directive('csDropdown', function($window, $rootScope) {
return {
restrict: 'A',
scope: {
bool: '=csDropdown'
},
link: function(scope, elem, attrs) {
var page = angular.element($window);
// On Dropdown Button Pressed