Skip to content

Instantly share code, notes, and snippets.

import Plugin from 'awv3/plugin/base';
import Integration from 'awv3/plugin/integration';
class MyPlugin extends Plugin {
constructor() {
super();
// ... functionality
}
}
@drcmda
drcmda / gist:9d308cb293781f322c77ad03e47e741f
Created September 16, 2016 08:30
multiple interaction handles, keyed
application
canvas
scene
class VersatileObject(obj1) -> eventhandler
obj2 -> eventhandler
obj3 -> eventhandler
plugins
UI elements [selection] -> notify
pluginsystem->events->override
@drcmda
drcmda / .js
Last active October 24, 2016 15:07
plugin specs, draft nearing final: PLUGIN DEFINITION
import Plugin from 'awv3/session/plugin';
import { Group, Button, Input, Label, Selection, Checkbox, Dropdown } from 'awv3/session/elements';
export default class extends Plugin {
constructor(session, { name }) {
super(session, { type: "Measure", name });
// 1. Elements SHOULD be created in the constructor. They can be stored in any way or form,
// in this case we use 'this' so that they are accessibable throuout the plugin
@drcmda
drcmda / .js
Created October 24, 2016 15:10
plugin specs, draft nearing final: SESSION USE
import Session from 'awv3/session';
// Create session
const session = window.session = new Session({
debug: true,
connection: 'http://localhost:8181/'
});
// Wait until we're connected
session.onConnected().then(server => {
@drcmda
drcmda / .js
Last active January 26, 2017 11:33
material, outlining extensible structures for appearance
// ALL material info (including opacity & color) is defined under a generialized "material"
// ALL properties are optional
// color & opacity will be removed from the protocol
material: {
type: BASIC | PHONG | LAMBERT | PHYSICAL | DASHED (lines only)
opacity: 0-1,
color: [0-255, 0-255, 0-255],
fog: true | false, // affected by fog
lights: true | false, // affected by lights
@drcmda
drcmda / .js
Created March 24, 2017 12:27
vue connect
import cloneDeep from 'lodash/cloneDeep';
import Session from 'awv3/session';
// Create & export session
export const session = window.session = new Session({ material: 'multi' });
// Export store
export const store = session.store;
// Mixin factory. Maps Redux props to Vue components
export const connect = (selector, props) => {
globals.color {
objectHoverColor: ...
materialHoverColor: ...
}
Mesh.material = [{ ... }, {}, {}] || { ... }
const array = [...Mesh.material]
array.forEach( ... )
@drcmda
drcmda / *.js
Last active November 15, 2017 09:41
Redux thunk example
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import _ from 'lodash';
// these types describe what i can do
const types = {
fetch: "ACTION_ADD",
remove: "ACTION_REMOVE"
}
@drcmda
drcmda / index.html
Last active February 7, 2018 12:36
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello World</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
</head>
<body>
import React from "react"
import styled from "styled-components"
import { animated } from 'react-spring'
const AnimatedButton = ({ toggleModal, hostRef, deal, pictureRef, style, src }) => (
<AnimateButtonStyling
innerRef={hostRef}
pictureRef={pictureRef}
style={style}
onClick={() => toggleModal()}>