lutzer / node-red-contrib-easing

MIT License
3 stars 2 forks source link

Feature request: arrays #1

Closed natcl closed 4 years ago

natcl commented 4 years ago

Hello, really love this node ! It would be great if it could also process arrays, would love being able to send something like { "from" : [255,0,0], "to" : [0,0,255], "duration": 1000 }

lutzer commented 4 years ago

you can do that using the split node and by using the array mode of the easing node. check this example flow:

[{"id":"21784a6.c375fb6","type":"debug","z":"bb1198da.daa558","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":440,"wires":[]},{"id":"bb312b26.65d658","type":"easing","z":"bb1198da.daa558","name":"","easingType":"easeOutQuad","outputType":"asArray","duration":"1000","interval":50,"numberOfValues":10,"x":430,"y":440,"wires":[["21784a6.c375fb6"]]},{"id":"10780b7c.1fefb5","type":"inject","z":"bb1198da.daa558","name":"","topic":"","payload":"[{\"from\":2,\"to\":3},{\"from\":3,\"to\":4}]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":440,"wires":[["68269ee1.420be"]]},{"id":"68269ee1.420be","type":"split","z":"bb1198da.daa558","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":290,"y":440,"wires":[["bb312b26.65d658"]]}]

adding a join node after the easing node will join the arrays together into one message.

natcl commented 4 years ago

But how would you interpolate over time then ?

lutzer commented 4 years ago

Could you give me an example what you wanna do? would it be possible to simply use multiple easing nodes or is the array size dynamic?