Dancing Stuff
This commit is contained in:
1 parent
4e579df61e
commit
1687f96166
4 files changed
+74
-24
No files matched your search
@@ -63,7 +63,7 @@ function newFloatingLayer () {
|
||||
|
||||
let dyingFloatingObjects = []
|
||||
|
||||
let maxTargetRepulsionForce = 0.003
|
||||
let maxTargetRepulsionForce = 0.001
|
||||
let currentHandle = 0
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -52,6 +52,7 @@ function newStrategyPart () {
|
||||
]
|
||||
|
||||
let floatingLayer
|
||||
let isMouseOver = false
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -107,6 +108,8 @@ function newStrategyPart () {
|
||||
|
||||
menuItem.targetRadius = menuItem.rawRadius * 1.5
|
||||
}
|
||||
|
||||
isMouseOver = true
|
||||
}
|
||||
|
||||
function onMouseNotOver () {
|
||||
@@ -115,6 +118,8 @@ function newStrategyPart () {
|
||||
|
||||
menuItem.targetRadius = menuItem.rawRadius * 0 - i * 5
|
||||
}
|
||||
|
||||
isMouseOver = false
|
||||
}
|
||||
|
||||
function onMouseClick (pPoint, pFloatingObject) {
|
||||
@@ -312,7 +317,7 @@ function newStrategyPart () {
|
||||
|
||||
label = pFloatingObject.payload.profile.downLabel
|
||||
|
||||
if (label !== undefined) {
|
||||
if (label !== undefined && isMouseOver === true) {
|
||||
labelPoint = {
|
||||
x: pFloatingObject.currentPosition.x - label.length / 2 * fontSize * FONT_ASPECT_RATIO,
|
||||
y: pFloatingObject.currentPosition.y + pFloatingObject.currentImageSize / 2 + fontSize * FONT_ASPECT_RATIO + 15
|
||||
|
||||
@@ -37,6 +37,7 @@ function newStrategyParts () {
|
||||
floatingObject.initialize('Strategy Part', floatingLayer, onInitialized)
|
||||
|
||||
function onInitialized (err) {
|
||||
const FRICTION = 0.98
|
||||
floatingObject.payload = pPayload
|
||||
|
||||
switch (type) {
|
||||
@@ -68,39 +69,78 @@ function newStrategyParts () {
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
default: {
|
||||
case 'Phase': {
|
||||
level_3()
|
||||
break
|
||||
}
|
||||
case 'Situation': {
|
||||
level_4()
|
||||
break
|
||||
}
|
||||
case 'Condition': {
|
||||
level_5()
|
||||
break
|
||||
}
|
||||
default: {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> Part Type not Recognized -> type = ' + type) }
|
||||
}
|
||||
}
|
||||
|
||||
function level_1 () {
|
||||
floatingObject.friction = 0.9
|
||||
floatingObject.friction = FRICTION
|
||||
|
||||
floatingObject.initializeMass(100)
|
||||
floatingObject.initializeRadius(50)
|
||||
floatingObject.initializeImageSize(60)
|
||||
floatingObject.initializeRadius(40)
|
||||
floatingObject.initializeImageSize(70)
|
||||
floatingObject.initializeFontSize(10)
|
||||
|
||||
floatingObject.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 0.5)'
|
||||
}
|
||||
|
||||
function level_2 () {
|
||||
floatingObject.friction = 0.85
|
||||
floatingObject.friction = FRICTION
|
||||
|
||||
floatingObject.initializeMass(50)
|
||||
floatingObject.initializeRadius(30)
|
||||
floatingObject.initializeImageSize(50)
|
||||
floatingObject.initializeFontSize(10)
|
||||
|
||||
floatingObject.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 0.5)'
|
||||
}
|
||||
|
||||
function level_3 () {
|
||||
floatingObject.friction = 0.8
|
||||
floatingObject.friction = FRICTION
|
||||
|
||||
floatingObject.initializeMass(10)
|
||||
floatingObject.initializeRadius(20)
|
||||
floatingObject.initializeImageSize(30)
|
||||
floatingObject.initializeFontSize(10)
|
||||
|
||||
floatingObject.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 0.5)'
|
||||
}
|
||||
|
||||
function level_4 () {
|
||||
floatingObject.friction = FRICTION
|
||||
|
||||
floatingObject.initializeMass(10)
|
||||
floatingObject.initializeRadius(15)
|
||||
floatingObject.initializeImageSize(20)
|
||||
floatingObject.initializeFontSize(10)
|
||||
|
||||
floatingObject.fillStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', 0.5)'
|
||||
}
|
||||
|
||||
function level_5 () {
|
||||
floatingObject.friction = FRICTION
|
||||
|
||||
floatingObject.initializeMass(10)
|
||||
floatingObject.initializeRadius(10)
|
||||
floatingObject.initializeImageSize(50)
|
||||
floatingObject.initializeImageSize(10)
|
||||
floatingObject.initializeFontSize(10)
|
||||
|
||||
floatingObject.fillStyle = 'rgba(' + UI_COLOR.MANGANESE_PURPLE + ', 0.5)'
|
||||
}
|
||||
|
||||
floatingObject.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 0.5)'
|
||||
floatingObject.labelStrokeStyle = 'rgba(60, 60, 60, 0.50)'
|
||||
|
||||
floatingLayer.addFloatingObject(floatingObject)
|
||||
|
||||
@@ -52,7 +52,7 @@ function newStrategyCollectionItem () {
|
||||
}
|
||||
}
|
||||
|
||||
function createPart (partType, name, node, parentNode) {
|
||||
function createPart (partType, name, node, parentNode, title) {
|
||||
let payload = {
|
||||
profile: {
|
||||
position: {
|
||||
@@ -66,7 +66,12 @@ function newStrategyCollectionItem () {
|
||||
|
||||
let imageId // 'My Image.png'
|
||||
|
||||
payload.profile.upLabel = partType
|
||||
if (title !== undefined) {
|
||||
payload.profile.upLabel = title
|
||||
} else {
|
||||
payload.profile.upLabel = partType
|
||||
}
|
||||
|
||||
payload.profile.downLabel = name
|
||||
payload.profile.imageId = imageId
|
||||
payload.profile.botAvatar = 'dont know what this is'
|
||||
@@ -92,48 +97,48 @@ function newStrategyCollectionItem () {
|
||||
createPart('Strategy Entry', '', strategy.entryPoint, strategy)
|
||||
for (let k = 0; k < strategy.entryPoint.situations.length; k++) {
|
||||
let situation = strategy.entryPoint.situations[k]
|
||||
createPart('Situation', situation.name, situation, strategy.entryPoint)
|
||||
createPart('Situation', situation.name, situation, strategy.entryPoint, 'Situation' + ' ' + (k + 1))
|
||||
|
||||
for (let m = 0; m < situation.conditions.length; m++) {
|
||||
let condition = situation.conditions[m]
|
||||
createPart('Condition', condition.name, condition, situation)
|
||||
createPart('Condition', condition.name, condition, situation, 'Condition' + ' ' + (m + 1))
|
||||
}
|
||||
}
|
||||
|
||||
createPart('Strategy Exit', '', strategy.exitPoint, strategy)
|
||||
for (let k = 0; k < strategy.exitPoint.situations.length; k++) {
|
||||
let situation = strategy.exitPoint.situations[k]
|
||||
createPart('Situation', situation.name, situation, strategy.exitPoint)
|
||||
createPart('Situation', situation.name, situation, strategy.exitPoint, 'Situation' + ' ' + (k + 1))
|
||||
|
||||
for (let m = 0; m < situation.conditions.length; m++) {
|
||||
let condition = situation.conditions[m]
|
||||
createPart('Condition', condition.name, condition, situation)
|
||||
createPart('Condition', condition.name, condition, situation, 'Condition' + ' ' + (m + 1))
|
||||
}
|
||||
}
|
||||
|
||||
createPart('Trade Entry', '', strategy.sellPoint, strategy)
|
||||
for (let k = 0; k < strategy.sellPoint.situations.length; k++) {
|
||||
let situation = strategy.sellPoint.situations[k]
|
||||
createPart('Situation', situation.name, situation, strategy.sellPoint)
|
||||
createPart('Situation', situation.name, situation, strategy.sellPoint, 'Situation' + ' ' + (k + 1))
|
||||
|
||||
for (let m = 0; m < situation.conditions.length; m++) {
|
||||
let condition = situation.conditions[m]
|
||||
createPart('Condition', condition.name, condition, situation)
|
||||
createPart('Condition', condition.name, condition, situation, 'Condition' + ' ' + (m + 1))
|
||||
}
|
||||
}
|
||||
|
||||
createPart('Stop', '', strategy.stopLoss, strategy)
|
||||
for (let p = 0; p < strategy.stopLoss.phases.length; p++) {
|
||||
let phase = strategy.stopLoss.phases[p]
|
||||
createPart('Phase', phase.name, phase, strategy.stopLoss)
|
||||
createPart('Phase', phase.name, phase, strategy.stopLoss, 'Phase' + ' ' + (p + 1))
|
||||
|
||||
for (let k = 0; k < phase.situations.length; k++) {
|
||||
let situation = phase.situations[k]
|
||||
createPart('Situation', situation.name, situation, phase)
|
||||
createPart('Situation', situation.name, situation, phase, 'Situation' + ' ' + (k + 1))
|
||||
|
||||
for (let m = 0; m < situation.conditions.length; m++) {
|
||||
let condition = situation.conditions[m]
|
||||
createPart('Condition', condition.name, condition, situation)
|
||||
createPart('Condition', condition.name, condition, situation, 'Condition' + ' ' + (m + 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,15 +146,15 @@ function newStrategyCollectionItem () {
|
||||
createPart('Take Profit', '', strategy.buyOrder, strategy)
|
||||
for (let p = 0; p < strategy.buyOrder.phases.length; p++) {
|
||||
let phase = strategy.buyOrder.phases[p]
|
||||
createPart('Phase', phase.name, phase, strategy.buyOrder)
|
||||
createPart('Phase', phase.name, phase, strategy.buyOrder, 'Phase' + ' ' + (p + 1))
|
||||
|
||||
for (let k = 0; k < phase.situations.length; k++) {
|
||||
let situation = phase.situations[k]
|
||||
createPart('Situation', situation.name, situation, phase)
|
||||
createPart('Situation', situation.name, situation, phase, 'Situation' + ' ' + (k + 1))
|
||||
|
||||
for (let m = 0; m < situation.conditions.length; m++) {
|
||||
let condition = situation.conditions[m]
|
||||
createPart('Condition', condition.name, condition, situation)
|
||||
createPart('Condition', condition.name, condition, situation, 'Condition' + ' ' + (m + 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user