Cycle.js drivers and action components for a tablet robot face.
Try the demo at StackBlitz!
Note that this package was tested with Chrome browser (>= 65.0.3325.181) only.
API
FacialExpressionAction(sources)
FacialExpression action component.
Params:
- sources
- goal: a stream of
null
(as "cancel") or a string 'happy'
, 'sad'
,
'angry'
, 'focused'
, or 'confused'
(as the TabletFace driver's
EXPRESS
type command value). - DOM: Cycle.js DOMSource.
Return:
- sinks
- output: a stream for the TabletFace driver.
- status: depreciated.
- result: a stream of action results.
result.result
is always null
.
SpeechbubbleAction(sources)
Speechbubble action component.
Params:
- sources
- goal: a stream of
null
(as "cancel"),
{type: 'MESSAGE', value: 'Hello world'}
or 'Hello world'
(as
"message"), or {type: 'CHOICE', value: ['Hello', 'World']}
or ['Hello', 'World']
(as "multiple choice"). - DOM: Cycle.js DOMSource.
Return:
TwoSpeechbubblesAction(sources)
TwoSpeechbubbles, Robot and Human, action component.
Params:
- sources
- goal: a stream of
null
(as "cancel"),
{type: 'SET_MESSAGE', value: 'Hello world'}
or 'Hello world'
(as
"set message"), or {type: 'ASK_QUESTION', message: 'Blue pill or red pill?', choices: ['Blue', 'Red']}
(as "ask multiple choice"). - DOM: Cycle.js DOMSource.
Return:
makeTabletFaceDriver(options)
TabletFace driver factory.
Params:
- options possible key includes
- styles {object} A group of optional face style parameters:
- faceColor {string} (default: 'whitesmoke')
- faceHeight {string} (default: '100vh')
- faceWidth {string} (default: '100vw')
- eyeColor {string} (default: 'black')
- eyeSize {string} (default: '33.33vmin')
- eyelidColor {string} (default: 'whitesmoke')
Return:
- Driver the TabletFace Cycle.js driver function. It takes a stream of
Command
and returns DOM
, animationFinish, and
load` streams.