连续 30 天 玩玩看 ProtoPie - Day 14

Focus In 跟 Focus Out 到底是什麽

今天终於要来看讲者解释 Focus Out 的意思。

昨天有提到 Focus 可以作为 Trigger 也可以做 Response 。

我们设定第二个输入栏「您的密码」(Input 2)为 Focus 的 Trigger ,并选 Focus Out 。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941V66S1Ztnc0.png

接着选 Focus 作为 Response,并且选择第三个输入栏「请再次输入密码」(Input 3) 来 Focus In。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941bqPBtILzDr.png

原来从头到尾就是,就是框内(Focus In)、框外(Focus Out)的差别...

因此,当使用者在「您的密码」(Input 2) 输入密码後,输入框外面点一下,就会自动跳到「请再次输入密码」(Input 3)。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941Sb4wmDxCL8.png

总算真相大白。

我猜用 Focus 语意上的意思就是,使用者聚焦在哪里的意思。

赞赞。

模拟使用者用语音输入

我们回到之前玩 Side Bar 的那个 IoT Home 页面。(ProtoPie 称之为 Scene)

https://ithelp.ithome.com.tw/upload/images/20210929/201419419D0idCZN5Q.png

我们打算模拟使用者点选下方的麦克风 icon 之後,跳到 Voice 这个 Scene 。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941Y9nMIFCSQk.png

快速走过前面做很多次的 Tap 这个 Trigger 。

选择麦克风 Icon 并设定 Tap 。

接着选择 Jump 作为 Response 并选择 Voice 这个页面。

https://ithelp.ithome.com.tw/upload/images/20210929/2014194192fQa9jxgs.png

用Preview 测试一下,顺利点击後转场换页。


接着在 Voice 这个页面,通常点击後跳来这个页面时就要 Trigger 某件行为发生。
(例如按下 Siri 就会进入一个新画面然後自动开始听你说话。)

因此先选择 Start 这个 Trigger。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941nZfMvXPZAJ.png

预设已经是 Start After Jump 。(也就是转场过来之後再开始)

https://ithelp.ithome.com.tw/upload/images/20210929/20141941C79fSQWJIn.png

接着 Response 往下滑会有一个 Listen ,点他。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941bjqWlhqH67.png

里面有非常多语言都能支援(这可能要测试看看...)

https://ithelp.ithome.com.tw/upload/images/20210929/20141941PGuMSrwLXd.png

里面有一个选项叫做 Continuous ,理论上如果勾选,讲者说会一直听下去。
但通常这一类语音互动都是一次给予一个指令,所以先不用勾。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941VmHyLBj6lH.png

存挡之後点 Preview ,会在底下看到一个闪烁的小麦克风图示。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941bYmtGbPZpP.png

好,确定 Prototype 能够听之後,接着选下一个Trigger, Voice Command。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941FSIHmkmck9.png

预设是 After Speaking 才会被触发(Trigger),也就是你可能说完一个指令之後才会进行 Response。

https://ithelp.ithome.com.tw/upload/images/20210929/201419417SRvWiZUEx.png

下方可以设定 Phrases ,就是你想要「讲到特定的字」被触发还是「特定的字被忽略」的时候触发。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941YRnk3wv1Cr.png

一时想不太到什麽时候会用到「特定的字被忽略」这样的情境...

我在想是不是特别要听某些事件,但没听到某个关键字,就能给回应说「你说的该不会是...「特定被忽略的字」吧」?

而你也可以选择 No phrases detected ,也就是如果完全没收到音或是可能没讲话,系统就能设定一些回应。

我们先来尝试把使用者讲的话呈现在萤幕上吧。

(这种思维真的是标准的除错,先 print 再说。)

因为我们想要把讲的话都显示出来,所以我们选择 While Speaking。
而且因为我们不是要讲一句指令就结束,所以可以把 Command 取消打勾。

https://ithelp.ithome.com.tw/upload/images/20210929/201419415lIaHSBEJG.png

接着 Response 我们选择Text ,并且设定萤幕上的 I’m Listening 这个地方。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941KnkxjdXvG3.png

https://ithelp.ithome.com.tw/upload/images/20210929/201419419HCVTo0oyJ.png

然後我们就要使用 Formula 了!

https://ithelp.ithome.com.tw/upload/images/20210929/2014194131jOoPJyCK.png

选择 Formula ,点一下下面输入栏右侧的图示,就会跳出一行可输入的黑框。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941k41cUWuVht.png

先打一个 $ 符号...就会跳出很多可以选择。

https://ithelp.ithome.com.tw/upload/images/20210929/20141941ocz8hvdtws.png

继续打,完整写出 $voicetranscript 。
(我发现voice拼成 vocie也是会帮你自动选择...)

https://ithelp.ithome.com.tw/upload/images/20210929/20141941gg9VeW2Aj8.png

接下来使用 Preivew ,我还特别是了一下繁体中文(疑?语音是这样分吗)然後真的显示了我讲的话!!!
(这截图有够难截图...)

https://ithelp.ithome.com.tw/upload/images/20210929/20141941wDYdw2HEir.png

https://ithelp.ithome.com.tw/upload/images/20210929/2014194167ZrDN1woP.png

两个礼拜了。

好像每天写一点、写一点,也才这麽一点东西呢。

真心感恩以前读过的各种文章,谢谢愿意分享的你。


<<:  管理职不是屎缺,但也不好做

>>:  [Day14][笔记] React 事件处理

Day12 - audio tag 帮我设定背景音乐

透过 audio tag 设定背景音乐 class BGM { constructor() { th...

[C 语言笔记--Day30] 最後一天的心得

这次参加铁人赛,有很大一部份是受到老石谈芯的影响 他曾经在做视频如何改变人生这部影片当中说了一个小故...

Day 28 自注意力(Self-Attention) 机制

我们昨天介绍了 Transformer 的结构,但是并没有介绍到 Transformer 内最神秘的...

Backtrader - 自订 datafeeds

我们之前在喂历史资料,都是先用 shioaji 下载下来,然後再用 padas 转成 datafra...

乔叔教 Elastic - 28 - Elasticsearch 的优化技巧 (2/4) - Searching 搜寻效能优化

Elasticsearch 的优化技巧 系列文章索引 (1/4) - Indexing 索引效能优化...