Home Reference Source
import Myr from 'myr/src/myr/Myr.js'
public class | source

Myr

Constructor Summary

Public Constructor
public

constructor(baseEls: object)

Instantiate MYR class

Member Summary

Public Members
public

ambientLight(params: object): *

Render an Ambient light with current cursor light settings

public

animate(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Animate the Aframe element which is passed as arg, its same as spin but without linear easing

public

assets: *[]

public

baseEls: *

public

box(params: object): *

Render an Aframe box with current Myr settings

public

change(outerElId: string, type: string, newParam: *): Error: *

Interface for setting an object's parameters in the DOM the idea is the setup an event listener as an almost DOM ready listener.

Ex. change(box(),"material","color:green;");

public

circle(params: object): *

Render an Aframe circle with current Myr settings

public

colorShift(outerElId: string, color: string): *

Apply a colorShift animation toe the Aframe element

public

Change the html color code to the hexadecimal

public

cone(params: object): *

Render an Aframe cone with current Myr settings

public
public

cursor: {"color": string, "texture": *, "transparency": *, "position": *, "scale": *, "rotation": *, "radius": string, "phiLength": number, "loop": boolean, "textureColoring": *, "textureRepeatWidth": number, "textureRepeatHeight": number, "duration": number, "magnitude": *, "light": *}

public

cylinder(params: object): *

Render an Aframe cylinder with current Myr settings

public

directionalLight(params: object): *

Render a Directional light with current cursor light settings

public

dodecahedron(params: object): *

Render an Aframe dodecahedron with current Myr settings

public

drop(outerElId: string): string: *

Looks like a temporary function that just apply physics with constant mass

public

els: *[]

public

fadeIn(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a fadeIn animation to the Aframe element which is passed as arg

public

fadeOut(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a fadeOut animation to the Aframe element which is passed as arg

public

Generate unique id that is assigned to each entity

public

Gets the current color of the cursor

public

Get the any values of the exisitng cursor attribute

public

Gets the current duration of the cursor

public

getEl(outerElId: string): *

Gets the element associated with the given element ID

public

getLoop: *

Gets the current lopp of the cursor

public

Gets the current magnitude of the cursor

public

Gets the current phi length of the cursor

public

Gets the current radius of the cursor

public

getRandomColor(colors: array): *

Returns a random valid color.

public

Gets the current texture of the cursor

public

getXPos: *

Gets the current x position of the cursor

public

Gets the current x rotation of the cursor

public

Gets the current x scale of the cursor

public

getYPos: *

Gets the current y position of the cursor

public

Gets the current y rotation of the cursor

public

Gets the current y scale of the cursor

public

getZPos: *

Gets the current z position of the cursor

public

Gets the current z rotation of the cursor

public

Gets the current z scale of the cursor

public

gltfModel(src: string, params: *): *

Load and render a custom glTF model with current Myr settings

public

goAway(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a goAway animation to the Aframe element which is passed as arg

public

goDown(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a goDown animation to the Aframe element which is passed as arg

public

goLeft(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a goLeft animation to the Aframe element which is passed as arg

public

goRight(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a goRight animation to the Aframe element which is passed as arg

public

goTowards(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a goTowards animation to the Aframe element which is passed as arg

public

goUp(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a goUp animation to the Aframe element which is passed as arg

public

group: *

Return a Entity that can be used to group elements together

public

grow(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a grow animation to the Aframe element which is passed as arg

public

hemisphereLight(secondColor: string, params: object): *

Render an Hemisphere light with current cursor light settings

public

icosahedron(params: object): *

Render an Aframe icosahedron with current Myr settings

public

Increases the current x, y, and z position of the cursor by the given amount

public

Increases the current x position of the cursor by the given amount

public

Increases the current y position of the cursor by the given amount

public

Increases the current z position of the cursor by the given amount

public

Infinite loop detector that's not use in anywhere

public

init({}: *): *

init creates and binds the myr object to the window

public

line(path: string, params: object): *

Render an Aframe line with current Myr settings

public

makeDroppable(outerElId: string, mass: number): *

Allows the entity to be dropped

public

makePushable(outerElId: string, mass: number): *

Allows the entity to be pushed

public

makeUnDroppable(outerElId: string): *

Disallows the entity to be dropped

public

makeUnPushable(outerElId: string): *

Disallows the entity to be pushed

public

mergeProps(shape: string, params: obj): *

This creates an entity w shape of object and merges with supplied params

public

octahedron(params: object): *

Render an Aframe octahedron with current Myr settings

public

pitchX(x: number): *

Applies a given x rotation to the cursor

public

plane(params: object): *

Render an Aframe plane with current Myr settings

public

pointLight(params: object): *

Render an point light with current cursor light settings

public

prism(params: object): *

Render an Aframe polyhedron with current Myr settings

public

push: *

Looks like temporary function similar to makePushable that apply force the pass object to x,y,z direction Not working.

public

res: {"els": *, "assets": *}

public

reset: *

Reset this.els to the base elements supplied to the constructor

public

Reset the animation properties of the cursor to the default

public

Reset the cursor to the default

public

Reset the light properties of the cursor to the default

public

Reset the transformation properties of the cursor to the default

public

ring(params: object): *

Render an Aframe ring with current Myr settings

public

rollZ(z: number): *

Applies a given z rotation to the cursor

public

sceneEl: *

public

setBeamAngle(beamAngle: number): *

Set the extent of the spotlight

public

setColor(color: number): *

Sets the current color of the cursor.

public

setCursorAttribute(key: string, value: any): *

Sets the existing cursor as well as creates a new custom cursor attributes to apply to entity

public

setDecay(decay: number): *

Set the decay of the light

public

setDiffusion(diffusion: number): *

Set the diffusion(penumbra) around the edge of the light

public

setDistance(distance: number): *

Set the distance of the light dims as it travels

public

Sets the duration of the cursor

public

setIntensity(intensity: number): *

Set the intensity of the light

public

Set the position of where the lights are facing towards

public

setLoop(i: number): *

Sets the loop of the cursor

public

Sets the magnitude of the cursor

public

Sets the phi length of the cursor

public

setPosition(x: number, y: number, z: number): *

Sets the x, y, and z position of the cursor

public

setRadius(i: number): *

Sets the radius of the cursor

public
public

setRotation(x: number, y: number, z: number): *

Sets the x, y, and z rotation of the cursor

public

setScale(x: number, y: number, z: number): *

Sets the x, y, and z scale of the cursor

public

setTexture(texture: string, w: number, h: number): *

Sets the texture of the cursor.

public

Sets whether to enable to color the texture or not

public

setTransparency(transparency: number): *

Sets the transparency of the cursor

public

setXPos(x: number): *

Sets the x position of the cursor

public

setXScale(x: number): *

Applies a given scale along the x dimension of the cursor

public

setYPos(y: number): *

Sets the y position of the cursor

public

setYScale(y: number): *

Applies a given scale along the y dimension of the cursor

public

setZPos(z: number): *

Sets the z position of the cursor

public

setZScale(z: number): *

Applies a given scale along the z dimension of the cursor

public

shrink(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a shrink animation to the Aframe element which is passed as arg

public

sideToSide(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a sideToSide animation to the Aframe element which is passed as arg

public

sleep(ms: number): *

It looks like a promise that sleep for certain ms and user can set further action after the time out.

public

sphere(params: object): *

Render an Aframe sphere with current Myr settings

public

spin(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a spin animation to the Aframe element which is passed as arg

public

spinX(outerElId: number, magnitude: number, loop: boolean, duration: number, spinType: string): *

Apply a spin animation on the X axis to the Aframe element which is passed as arg

public

spinY(outerElId: number, magnitude: number, loop: boolean, duration: number, spinType: string): *

Apply a spin animation on the X axis to the Aframe element which is passed as arg

public

spinZ(outerElId: number, magnitude: number, loop: boolean, duration: number, spinType: string): *

Apply a spin animation on the Z axis to the Aframe element which is passed as arg

public

spotLight(params: object): *

Render a Spot light with current cursor light settings

public

syncChange(outerElId: string, type: string, newParam: *): Error: *

Interface for setting an object's parameters in the DOM w/o the event listener dispatching the events It's not working/I don't know how this work"

public

tetrahedron(params: object): *

Render an Aframe tetrahedron with current Myr settings

public

text(text: string, params: object): *

Render an Aframe text with current Myr settings

public

torus(params: object): *

Render an Aframe torus with current Myr settings

public

torusknot(params: object): *

Render an Aframe torusknot with current Myr settings

public

transfer(id: string): *

Transfer the object from MYR to the Entity.

public

triangle(params: object): *

Render an Aframe triangle with current Myr settings

public

tube(path: string, params: object): *

Render an Aframe tube with current Myr settings

public

yawY(y: number): *

Applies a given y rotation to the cursor

public

yoyo(outerElId: number, magnitude: number, loop: boolean, duration: number): *

Apply a yoyo animation to the Aframe element which is passed as arg

Public Constructors

public constructor(baseEls: object) source

Instantiate MYR class

Params:

NameTypeAttributeDescription
baseEls object

list of the entities restore to the new MYR

Public Members

public ambientLight(params: object): * source

Render an Ambient light with current cursor light settings

public animate(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Animate the Aframe element which is passed as arg, its same as spin but without linear easing

public assets: *[] source

public baseEls: * source

public box(params: object): * source

Render an Aframe box with current Myr settings

public change(outerElId: string, type: string, newParam: *): Error: * source

Interface for setting an object's parameters in the DOM the idea is the setup an event listener as an almost DOM ready listener.

Ex. change(box(),"material","color:green;");

Return:

Error

Return error if query fail to retrieve the passed Id

public circle(params: object): * source

Render an Aframe circle with current Myr settings

public colorShift(outerElId: string, color: string): * source

Apply a colorShift animation toe the Aframe element

public colourNameToHex(colour: string): string: * source

Change the html color code to the hexadecimal

Return:

string

Hexadecimal representation of the color, return false if color not found.

public cone(params: object): * source

Render an Aframe cone with current Myr settings

public counter: number source

public cursor: {"color": string, "texture": *, "transparency": *, "position": *, "scale": *, "rotation": *, "radius": string, "phiLength": number, "loop": boolean, "textureColoring": *, "textureRepeatWidth": number, "textureRepeatHeight": number, "duration": number, "magnitude": *, "light": *} source

public cylinder(params: object): * source

Render an Aframe cylinder with current Myr settings

public directionalLight(params: object): * source

Render a Directional light with current cursor light settings

public dodecahedron(params: object): * source

Render an Aframe dodecahedron with current Myr settings

public drop(outerElId: string): string: * source

Looks like a temporary function that just apply physics with constant mass

Return:

string

outerElId

public els: *[] source

public fadeIn(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a fadeIn animation to the Aframe element which is passed as arg

public fadeOut(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a fadeOut animation to the Aframe element which is passed as arg

public genNewId: * source

Generate unique id that is assigned to each entity

public getColor: * source

Gets the current color of the cursor

public getCursorAttribute(key: string): *: * source

Get the any values of the exisitng cursor attribute

Return:

*

Value of the cursor attribute if it exists

public getDuration: * source

Gets the current duration of the cursor

public getEl(outerElId: string): * source

Gets the element associated with the given element ID

public getLoop: * source

Gets the current lopp of the cursor

public getMagnitude: * source

Gets the current magnitude of the cursor

public getPhiLength: * source

Gets the current phi length of the cursor

public getRadius: * source

Gets the current radius of the cursor

public getRandomColor(colors: array): * source

Returns a random valid color.

public getTexture: * source

Gets the current texture of the cursor

public getXPos: * source

Gets the current x position of the cursor

public getXRotation: * source

Gets the current x rotation of the cursor

public getXScale: * source

Gets the current x scale of the cursor

public getYPos: * source

Gets the current y position of the cursor

public getYRotation: * source

Gets the current y rotation of the cursor

public getYScale: * source

Gets the current y scale of the cursor

public getZPos: * source

Gets the current z position of the cursor

public getZRotation: * source

Gets the current z rotation of the cursor

public getZScale: * source

Gets the current z scale of the cursor

public gltfModel(src: string, params: *): * source

Load and render a custom glTF model with current Myr settings

public goAway(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a goAway animation to the Aframe element which is passed as arg

public goDown(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a goDown animation to the Aframe element which is passed as arg

public goLeft(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a goLeft animation to the Aframe element which is passed as arg

public goRight(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a goRight animation to the Aframe element which is passed as arg

public goTowards(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a goTowards animation to the Aframe element which is passed as arg

public goUp(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a goUp animation to the Aframe element which is passed as arg

public group: * source

Return a Entity that can be used to group elements together

public grow(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a grow animation to the Aframe element which is passed as arg

public hemisphereLight(secondColor: string, params: object): * source

Render an Hemisphere light with current cursor light settings

public icosahedron(params: object): * source

Render an Aframe icosahedron with current Myr settings

public increasePosition(x: number, y: number, z: number): * source

Increases the current x, y, and z position of the cursor by the given amount

public increaseXPos(x: number): * source

Increases the current x position of the cursor by the given amount

public increaseYPos(y: number): * source

Increases the current y position of the cursor by the given amount

public increaseZPos(z: number): * source

Increases the current z position of the cursor by the given amount

public infiniteLoopDetector: * source

Infinite loop detector that's not use in anywhere

public init({}: *): * source

init creates and binds the myr object to the window

public line(path: string, params: object): * source

Render an Aframe line with current Myr settings

public makeDroppable(outerElId: string, mass: number): * source

Allows the entity to be dropped

public makePushable(outerElId: string, mass: number): * source

Allows the entity to be pushed

public makeUnDroppable(outerElId: string): * source

Disallows the entity to be dropped

public makeUnPushable(outerElId: string): * source

Disallows the entity to be pushed

public mergeProps(shape: string, params: obj): * source

This creates an entity w shape of object and merges with supplied params

public octahedron(params: object): * source

Render an Aframe octahedron with current Myr settings

public pitchX(x: number): * source

Applies a given x rotation to the cursor

public plane(params: object): * source

Render an Aframe plane with current Myr settings

public pointLight(params: object): * source

Render an point light with current cursor light settings

public prism(params: object): * source

Render an Aframe polyhedron with current Myr settings

public push: * source

Looks like temporary function similar to makePushable that apply force the pass object to x,y,z direction Not working.

public res: {"els": *, "assets": *} source

public reset: * source

Reset this.els to the base elements supplied to the constructor

public resetAnimationCursor: * source

Reset the animation properties of the cursor to the default

public resetCursor: * source

Reset the cursor to the default

public resetLightCursor: * source

Reset the light properties of the cursor to the default

public resetTransformationCursor: * source

Reset the transformation properties of the cursor to the default

public ring(params: object): * source

Render an Aframe ring with current Myr settings

public rollZ(z: number): * source

Applies a given z rotation to the cursor

public sceneEl: * source

public setBeamAngle(beamAngle: number): * source

Set the extent of the spotlight

public setColor(color: number): * source

Sets the current color of the cursor. Defaults to white.

public setCursorAttribute(key: string, value: any): * source

Sets the existing cursor as well as creates a new custom cursor attributes to apply to entity

public setDecay(decay: number): * source

Set the decay of the light

public setDiffusion(diffusion: number): * source

Set the diffusion(penumbra) around the edge of the light

public setDistance(distance: number): * source

Set the distance of the light dims as it travels

public setDuration(i: number): * source

Sets the duration of the cursor

public setIntensity(intensity: number): * source

Set the intensity of the light

public setLightTarget(x: number, y: number, z: number): * source

Set the position of where the lights are facing towards

public setLoop(i: number): * source

Sets the loop of the cursor

public setMagnitude(i: number): * source

Sets the magnitude of the cursor

public setPhiLength(i: number): * source

Sets the phi length of the cursor

public setPosition(x: number, y: number, z: number): * source

Sets the x, y, and z position of the cursor

public setRadius(i: number): * source

Sets the radius of the cursor

public setRandomColor: * source

public setRotation(x: number, y: number, z: number): * source

Sets the x, y, and z rotation of the cursor

public setScale(x: number, y: number, z: number): * source

Sets the x, y, and z scale of the cursor

public setTexture(texture: string, w: number, h: number): * source

Sets the texture of the cursor. Defaults is empty string.

public setTextureColoring(i: boolean): * source

Sets whether to enable to color the texture or not

public setTransparency(transparency: number): * source

Sets the transparency of the cursor

public setXPos(x: number): * source

Sets the x position of the cursor

public setXScale(x: number): * source

Applies a given scale along the x dimension of the cursor

public setYPos(y: number): * source

Sets the y position of the cursor

public setYScale(y: number): * source

Applies a given scale along the y dimension of the cursor

public setZPos(z: number): * source

Sets the z position of the cursor

public setZScale(z: number): * source

Applies a given scale along the z dimension of the cursor

public shrink(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a shrink animation to the Aframe element which is passed as arg

public sideToSide(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a sideToSide animation to the Aframe element which is passed as arg

public sleep(ms: number): * source

It looks like a promise that sleep for certain ms and user can set further action after the time out. I don't know the original purpose but I imagine it was something like this. ex. sleep(5000).then(()=>{ console.log("box!"); box(); }); But this will not render box on the scene because it adds the box to the list after Scene is renderered

public sphere(params: object): * source

Render an Aframe sphere with current Myr settings

public spin(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a spin animation to the Aframe element which is passed as arg

public spinX(outerElId: number, magnitude: number, loop: boolean, duration: number, spinType: string): * source

Apply a spin animation on the X axis to the Aframe element which is passed as arg

public spinY(outerElId: number, magnitude: number, loop: boolean, duration: number, spinType: string): * source

Apply a spin animation on the X axis to the Aframe element which is passed as arg

public spinZ(outerElId: number, magnitude: number, loop: boolean, duration: number, spinType: string): * source

Apply a spin animation on the Z axis to the Aframe element which is passed as arg

public spotLight(params: object): * source

Render a Spot light with current cursor light settings

public syncChange(outerElId: string, type: string, newParam: *): Error: * source

Interface for setting an object's parameters in the DOM w/o the event listener dispatching the events It's not working/I don't know how this work"

Return:

Error

Return error if query fail to retrieve the passed Id

public tetrahedron(params: object): * source

Render an Aframe tetrahedron with current Myr settings

public text(text: string, params: object): * source

Render an Aframe text with current Myr settings

This is a bit tricky. We need to pass text so we can decide how to render it. This throws a warning since text is not part of the entity system. Instead we pass it and then pull it off again if we see it.

public torus(params: object): * source

Render an Aframe torus with current Myr settings

public torusknot(params: object): * source

Render an Aframe torusknot with current Myr settings

public transfer(id: string): * source

Transfer the object from MYR to the Entity. Used to add entity to the group

public triangle(params: object): * source

Render an Aframe triangle with current Myr settings

public tube(path: string, params: object): * source

Render an Aframe tube with current Myr settings

public yawY(y: number): * source

Applies a given y rotation to the cursor

public yoyo(outerElId: number, magnitude: number, loop: boolean, duration: number): * source

Apply a yoyo animation to the Aframe element which is passed as arg