functionFan2.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  1. <template>
  2. <div style="width: 100%; height: calc(100%); background: #fff; display: flex">
  3. <div class="ablockly">
  4. <div id="blocklyDiv"></div>
  5. <xml id="toolbox" style="display: none">
  6. <category name="逻辑" colour="%{BKY_LOGIC_HUE}">
  7. <block type="controls_if"></block>
  8. <block type="logic_compare"></block>
  9. <block type="logic_operation"></block>
  10. <block type="logic_negate"></block>
  11. <block type="logic_boolean"></block>
  12. <block type="logic_number"></block>
  13. </category>
  14. <sep></sep>
  15. <category name="循环" colour="#5ba55b">
  16. <block type="controls_repeat_forever"></block>
  17. <block type="controls_whileUntil"></block>
  18. <block type="controls_for"></block>
  19. </category>
  20. <sep></sep>
  21. <category id="catIOTScreen" name="屏幕" colour="#5cb2d6">
  22. <block type="iot_lcd_screeninit"></block>
  23. </category>
  24. <sep></sep>
  25. <category id="cat" name="人脸识别" colour="#ee783a">
  26. <block type="iot_lcd_faceinit"></block>
  27. </category>
  28. <sep></sep>
  29. <category id="police" name="电子警察组件" colour="#1b5873">
  30. <block type="iot_lcd_policeinit"></block>
  31. </category>
  32. <sep></sep>
  33. <category id="police" name="AI组件" colour="#935ba5">
  34. <block type="ai_gesture"></block>
  35. <block type="ai_motor"></block>
  36. </category>
  37. </xml>
  38. </div>
  39. <div class="container">
  40. <div class="img">
  41. <div class="left" style="width: 120px"></div>
  42. <div class="controlZ">
  43. <div id="fan" ref="fan">
  44. <img :src="img[0]" alt />
  45. </div>
  46. <div id="fanB">
  47. <img :src="img[6]" alt />
  48. </div>
  49. <div id="motor">
  50. <img :src="img[1]" alt />
  51. </div>
  52. <div id="base">
  53. <img :src="img[2]" alt />
  54. </div>
  55. <div id="a4">
  56. <img :src="img[3]" alt />
  57. </div>
  58. <div id="screan">
  59. <img :src="img[4]" alt />
  60. <!--图片展示-->
  61. <video
  62. ref="video"
  63. id="video_cam"
  64. width="178"
  65. height="142.4"
  66. class="face"
  67. autoplay
  68. v-show="isCamera"
  69. ></video>
  70. <canvas
  71. ref="canvasDOM"
  72. width="178"
  73. height="142.4"
  74. class="kuang"
  75. v-show="isCamera"
  76. ></canvas>
  77. </div>
  78. <div id="line">
  79. <img :src="img[5]" alt />
  80. </div>
  81. </div>
  82. <div class="cameraZ">
  83. <!--开启摄像头-->
  84. <div class="cameraBtn">
  85. <div class="open" @click="start()" v-if="!isZuan">
  86. <img src="../assets/img/fan/icon.png" alt />
  87. </div>
  88. <div class="close" @click="closeCamera()" v-else>
  89. <img src="../assets/img/fan/icon2.png" alt />
  90. </div>
  91. </div>
  92. <!--确认-->
  93. <div v-show="false" class="isPhoto">
  94. <!--canvas截取流-->
  95. <canvas
  96. ref="canvas"
  97. width="300"
  98. height="240"
  99. v-show="false"
  100. ></canvas>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </template>
  107. <style>
  108. .as {
  109. animation: myfirst 1s;
  110. -webkit-animation: myfirst 1s; /* Safari and Chrome */
  111. }
  112. .asn {
  113. transform: rotate(0deg);
  114. }
  115. @keyframes myfirst {
  116. 0% {
  117. transform: rotate(0deg);
  118. }
  119. 100% {
  120. transform: rotate(360deg);
  121. }
  122. }
  123. @-webkit-keyframes myfirst /* Safari and Chrome */ {
  124. 0% {
  125. transform: rotate(0deg);
  126. }
  127. 100% {
  128. transform: rotate(360deg);
  129. }
  130. }
  131. .ass {
  132. animation: myfirst 3s;
  133. -webkit-animation: myfirst 3s; /* Safari and Chrome */
  134. }
  135. </style>
  136. <script>
  137. import * as handPoseDetection from "@tensorflow-models/hand-pose-detection";
  138. import "@tensorflow/tfjs-backend-webgl";
  139. import * as mpHands from "@mediapipe/hands";
  140. // 引入Blockly
  141. import Blockly from "blockly";
  142. // 引入想要转换的语言,语言有php python dart lua javascript
  143. import * as JavaScript from "blockly/javascript";
  144. import * as Blocks from "blockly/blocks";
  145. // 引入语言包并使用
  146. import * as hans from "blockly/msg/zh-hans";
  147. Blockly.setLocale(hans);
  148. //引入媒体文件:我是在github上下载的blockly源码,将源码中的media文件放入我项目中的public文件夹下
  149. //忽略被vue错认为组件的blockly中的标签,不止以下这些,请发现一个忽略一个
  150. import Vue from "vue";
  151. Vue.config.ignoredElements.push("xml");
  152. Vue.config.ignoredElements.push("block");
  153. Vue.config.ignoredElements.push("field");
  154. Vue.config.ignoredElements.push("category");
  155. Vue.config.ignoredElements.push("sep");
  156. Vue.config.ignoredElements.push("value");
  157. Vue.config.ignoredElements.push("statement");
  158. Vue.config.ignoredElements.push("mutation");
  159. export default {
  160. data() {
  161. return {
  162. that: this,
  163. img: [
  164. require("../assets/img/fan/fan.png"),
  165. require("../assets/img/fan/2.png"),
  166. require("../assets/img/fan/3.png"),
  167. require("../assets/img/fan/4.png"),
  168. require("../assets/img/fan/5.png"),
  169. require("../assets/img/fan/6.png"),
  170. require("../assets/img/fan/fanB.png"),
  171. ],
  172. shibieImg: require("../assets/img/face.png"),
  173. isCamera: false,
  174. isZuan: false,
  175. count: 0,
  176. change: 0,
  177. closeUpdateMessage: false,
  178. updateMessage: false,
  179. upName: "",
  180. number: 0,
  181. isdetected: "请您保持脸部在画面中央",
  182. videoEl: {},
  183. canvasEL: {},
  184. formLabelWidth: "100px",
  185. resultImg: {
  186. img: [],
  187. name: "",
  188. },
  189. // 预设样本图,支持本地,网络,beas64
  190. sampleArr: [
  191. // {
  192. // name: "编号1",
  193. // img: []
  194. // }
  195. ],
  196. // 匹配图,支持本地,网络,beas64
  197. detArr: [
  198. //"" 图片1
  199. ],
  200. numberOne: 0,
  201. // 匹配结果
  202. resultArr: [],
  203. // 人脸匹配矩阵数组对象转码结果
  204. faceMatcher: null,
  205. rotate: 0,
  206. timer: null,
  207. detector: null,
  208. hand: 0,
  209. isC: false,
  210. };
  211. },
  212. methods: {
  213. cancel() {
  214. this.updateMessage = false;
  215. this.sampleArr[this.sampleArr.length - 1].name = "编号:" + this.number;
  216. if (this.sampleArr.length > 0) {
  217. // var a = document.getElementsByClassName("spot");
  218. // a[0].style.display = "block";
  219. this.fnsample();
  220. }
  221. },
  222. start() {
  223. this.isZuan = true;
  224. this.isCamera = true;
  225. let video = this.$refs["video"];
  226. var that = this;
  227. window.requestAnimationFrame(function () {
  228. that.handsFind(video);
  229. that.start();
  230. });
  231. // setInterval(() => {
  232. // this.handsFind(video);
  233. // // window.requestAnimationFrame(this.start);
  234. // }, 1000);
  235. },
  236. zhuan() {
  237. var _fan = this.$refs.fan;
  238. _fan.className = "asn as";
  239. clearInterval(this.timer);
  240. this.timer = setInterval(function () {
  241. _fan.className = "asn";
  242. setTimeout(function () {
  243. _fan.className = "as";
  244. }, 0);
  245. }, 1000);
  246. },
  247. zhuann() {
  248. var _fan = this.$refs.fan;
  249. this.$refs.fan.className = "asn ass";
  250. clearInterval(this.timer);
  251. this.timer = setInterval(function () {
  252. _fan.className = "asn";
  253. setTimeout(function () {
  254. _fan.className = "ass";
  255. }, 0);
  256. }, 3000);
  257. },
  258. update() {
  259. this.change = 1;
  260. this.number = this.number + 1;
  261. if (this.change == 1) {
  262. if (this.sampleArr.length > 0) {
  263. this.sampleArr[this.sampleArr.length - 1].name = this.upName;
  264. this.isdetected = "已识别到" + this.resultImg.name + "的图片";
  265. }
  266. }
  267. if (this.sampleArr.length > 0) {
  268. // var a = document.getElementsByClassName("spot");
  269. // a[0].style.display = "block";
  270. this.fnsample();
  271. }
  272. this.updateMessage = false;
  273. },
  274. async handsFind(video) {
  275. let hands = await this.detector.estimateHands(video, {
  276. flipHorizontal: false,
  277. });
  278. console.log(hands);
  279. if (hands.length > 0 && this.isCamera) {
  280. let handsA = hands[0].keypoints;
  281. let _58y = handsA[5].y / handsA[8].y;
  282. let _912y = handsA[9].y / handsA[12].y;
  283. let _1316y = handsA[13].y / handsA[16].y;
  284. let _1720y = handsA[17].y / handsA[20].y;
  285. /*石头剪刀布的转速 */
  286. let buNum = 100;
  287. let sNum = 0;
  288. let jNum = 50;
  289. /**1布2石头3剪刀 */
  290. if (_58y > 1 && _912y > 1 && _1316y > 1 && _1720y > 1) {
  291. console.log("布");
  292. if (this.hand == 1) {
  293. return;
  294. }
  295. this.hand = 1;
  296. this.zhuan();
  297. } else if (_58y < 1 && _912y < 1 && _1316y < 1 && _1720y < 1) {
  298. console.log("石头");
  299. if (this.hand == 2) {
  300. return;
  301. }
  302. this.hand = 2;
  303. clearInterval(this.timer);
  304. this.$refs.fan.className = "asn";
  305. } else if (_58y > 1 && _912y > 1 && _1316y < 1 && _1720y < 1) {
  306. console.log("剪刀");
  307. if (this.hand == 3) {
  308. return;
  309. }
  310. this.hand = 3;
  311. this.zhuann();
  312. }
  313. }
  314. },
  315. // 调用摄像头
  316. callCamera() {
  317. const loading = this.$loading.service({
  318. background: "rgba(255, 255, 255, 0.7)",
  319. target: document.body,
  320. });
  321. let _this = this;
  322. // H5调用电脑摄像头API
  323. window.navigator.mediaDevices
  324. .getUserMedia({
  325. video: true,
  326. })
  327. .then((success) => {
  328. // 摄像头开启成功
  329. _this.$refs["video"].srcObject = success;
  330. // 实时拍照效果
  331. _this.$refs["video"].play();
  332. loading.close();
  333. })
  334. .catch((error) => {
  335. // console.error("摄像头开启失败,请检查摄像头是否可用!");
  336. _this.isC = false;
  337. _this.$message.error("摄像头开启失败,请检查摄像头是否可用!");
  338. loading.close();
  339. });
  340. },
  341. // 拍照
  342. photograph() {
  343. let ctx = this.$refs["canvas"].getContext("2d");
  344. // 把当前视频帧内容渲染到canvas上
  345. ctx.drawImage(this.$refs["video"], 0, 0, 300, 240);
  346. // 转base64格式、图片格式转换、图片质量压缩
  347. let imgBase64 = this.$refs["canvas"].toDataURL("image/jpeg", 0.7); // 由字节转换为KB 判断大小
  348. let str = imgBase64.replace("data:image/jpeg;base64,", "");
  349. let strLength = str.length;
  350. let fileLength = parseInt(strLength - (strLength / 8) * 2); // 图片尺寸 用于判断
  351. let size = (fileLength / 1024).toFixed(2);
  352. console.log(size); // 上传拍照信息 调用接口上传图片 .........
  353. // this.detArr.push(imgBase64);
  354. var json = { name: "", img: [] };
  355. this.number = this.number + 1;
  356. this.upName = "";
  357. json.img.push(imgBase64);
  358. this.sampleArr.push(json);
  359. this.updateMessage = true;
  360. },
  361. // 关闭摄像头
  362. closeCamera() {
  363. // if (!this.$refs["video"].srcObject) {
  364. // this.isCamera = false;
  365. // return;
  366. // }
  367. // let stream = this.$refs["video"].srcObject;
  368. // let tracks = stream.getTracks();
  369. // tracks.forEach((track) => {
  370. // track.stop();
  371. // });
  372. // this.$refs["video"].srcObject = null;
  373. this.isCamera = false;
  374. this.isZuan = false;
  375. clearInterval(this.timer);
  376. this.timer = null;
  377. this.hand = 0;
  378. },
  379. async fnInit() {
  380. const model = handPoseDetection.SupportedModels.MediaPipeHands;
  381. const detectorConfig = {
  382. runtime: "mediapipe", // or 'tfjs'
  383. modelType: "full",
  384. // solutionPath: `https://cdn.jsdelivr.net/npm/@mediapipe/hands@${mpHands.VERSION}`,
  385. solutionPath: `/static/hands`,
  386. };
  387. this.detector = await handPoseDetection.createDetector(
  388. model,
  389. detectorConfig
  390. );
  391. this.callCamera();
  392. },
  393. async fnsample() {
  394. const labeledFaceDescriptors = await Promise.all(
  395. this.sampleArr.map(async (item) => {
  396. // 临时图片转码数据,将图片对象转数据矩阵对象
  397. let descriptors = [];
  398. for (let image of item.img) {
  399. const imageEl = await faceapi.fetchImage(image);
  400. descriptors.push(await faceapi.computeFaceDescriptor(imageEl));
  401. }
  402. // 返回图片用户和图片转码数组
  403. return new faceapi.LabeledFaceDescriptors(item.name, descriptors);
  404. })
  405. );
  406. // 人脸匹配矩阵数组对象转码结果
  407. this.faceMatcher = new faceapi.FaceMatcher(labeledFaceDescriptors);
  408. },
  409. // 执行遍历识别匹配图片,数值误差越小越精确
  410. fnRun() {
  411. let ctx = this.$refs["canvas"].getContext("2d");
  412. // 把当前视频帧内容渲染到canvas上
  413. ctx.drawImage(this.$refs["video"], 0, 0, 300, 240);
  414. // 转base64格式、图片格式转换、图片质量压缩
  415. let imgBase64 = this.$refs["canvas"].toDataURL("image/jpeg", 0.7); // 由字节转换为KB 判断大小
  416. this.detArr = [];
  417. this.detArr.push(imgBase64);
  418. this.detArr.forEach(async (img) => {
  419. let ts = Date.now();
  420. // 将图片对象转数据矩阵对象,进行匹配
  421. const inputEl = await faceapi.fetchImage(img);
  422. const inputDescriptor = await faceapi.computeFaceDescriptor(inputEl);
  423. const bestMatch = await this.faceMatcher.findBestMatch(inputDescriptor);
  424. // 结果
  425. this.resultArr = [];
  426. this.resultArr.push({
  427. target: img,
  428. result: bestMatch.toString(),
  429. time: Date.now() - ts + "ms",
  430. fps: Math.round(1000 / (Date.now() - ts)),
  431. });
  432. console.log(this.resultArr);
  433. var a = document.getElementsByClassName("pFace");
  434. for (var i = 0; i < this.sampleArr.length; i++) {
  435. if (this.sampleArr[i].name == bestMatch.label) {
  436. // this.closeUpdateMessage = true;
  437. // if (this.change == 1) {
  438. // this.resultImg.name = this.upName;
  439. // } else {
  440. // this.resultImg.name = this.sampleArr[i].name;
  441. // }
  442. this.isdetected = "已识别到" + this.sampleArr[i].name + "的图片";
  443. this.shibieImg = this.sampleArr[i].img[0];
  444. if (this.shibieImg.length > 0) {
  445. a[0].style.width = "300px";
  446. }
  447. this.resultImg.img[0] = this.sampleArr[i].img[0];
  448. }
  449. }
  450. });
  451. },
  452. handleClose(done) {
  453. done();
  454. },
  455. // 更换匹配图
  456. async fnChange(e) {
  457. if (!e.target.files.length) return;
  458. this.detArr = [];
  459. this.resultArr = [];
  460. // 将文件显示为图像并识别
  461. e.target.files.forEach(async (file) => {
  462. let ts = Date.now();
  463. let img = await faceapi.bufferToImage(file);
  464. const inputDescriptor = await faceapi.computeFaceDescriptor(img);
  465. const bestMatch = await this.faceMatcher.findBestMatch(inputDescriptor);
  466. // 结果
  467. this.detArr.push(img.src);
  468. this.resultArr.push({
  469. target: file.name,
  470. result: bestMatch.toString(),
  471. time: Date.now() - ts + "ms",
  472. fps: Math.round(1000 / (Date.now() - ts)),
  473. });
  474. });
  475. },
  476. blocklyInit() {
  477. this.workspace = Blockly.inject("blocklyDiv", {
  478. //工具栏
  479. toolbox: document.getElementById("toolbox"),
  480. //网格效果
  481. grid: { spacing: 20, length: 3, colour: "#ccc", snap: true },
  482. //媒体资源
  483. media: "../assets/img/",
  484. //垃圾桶
  485. trashcan: true,
  486. });
  487. //工作区监听代码生成器
  488. this.workspace.addChangeListener(this.myUpdateFunction);
  489. Blockly.Blocks["iot_lcd_screeninit"] = {
  490. init: function () {
  491. this.appendDummyInput().appendField(
  492. new Blockly.FieldImage(
  493. require("../assets/img/screen_init_header.png"),
  494. 45,
  495. 45
  496. )
  497. );
  498. this.appendDummyInput().appendField("LCD屏幕打开");
  499. this.setInputsInline(false);
  500. this.setPreviousStatement(true);
  501. this.setNextStatement(true);
  502. this.setColour("#5cb2d6");
  503. this.setTooltip("");
  504. this.setHelpUrl("");
  505. },
  506. };
  507. Blockly.JavaScript.iot_lcd_screeninit = function (block) {
  508. var _code = "screen=1;";
  509. return _code;
  510. };
  511. Blockly.Blocks["iot_lcd_faceinit"] = {
  512. init: function () {
  513. this.appendDummyInput().appendField(
  514. new Blockly.FieldImage(
  515. require("../assets/img/face_recognition_header.png"),
  516. 45,
  517. 45
  518. )
  519. );
  520. this.appendDummyInput().appendField("人脸辨识");
  521. this.setInputsInline(false);
  522. this.setPreviousStatement(true);
  523. this.setNextStatement(true);
  524. this.setColour("#ee783a");
  525. this.setTooltip("");
  526. this.setHelpUrl("");
  527. },
  528. };
  529. Blockly.JavaScript.iot_lcd_faceinit = function (block) {
  530. var _code = "face=1;";
  531. return _code;
  532. };
  533. Blockly.Blocks["iot_lcd_policeinit"] = {
  534. init: function () {
  535. this.appendDummyInput().appendField(
  536. new Blockly.FieldImage(
  537. require("../assets/img/screen_init_header.png"),
  538. 45,
  539. 45
  540. )
  541. );
  542. this.appendDummyInput().appendField("电子警察组件");
  543. this.setInputsInline(false);
  544. this.setPreviousStatement(true);
  545. this.setNextStatement(true);
  546. this.setColour("#1b5873");
  547. this.setTooltip("");
  548. this.setHelpUrl("");
  549. },
  550. };
  551. Blockly.JavaScript.iot_lcd_policeinit = function (block) {
  552. var _code = "police=1;";
  553. return _code;
  554. };
  555. Blockly.Blocks["iot_lcd_trunLeftinit"] = {
  556. init: function () {
  557. this.appendDummyInput().appendField("向左移动");
  558. this.setInputsInline(false);
  559. this.setPreviousStatement(true);
  560. this.setNextStatement(true);
  561. this.setColour("#1b5873");
  562. this.setTooltip("");
  563. this.setHelpUrl("");
  564. },
  565. };
  566. Blockly.JavaScript.iot_lcd_trunLeftinit = function (block) {
  567. var _code = "trunLeft=1;";
  568. return _code;
  569. };
  570. Blockly.Blocks["iot_lcd_trunRightinit"] = {
  571. init: function () {
  572. this.appendDummyInput().appendField("向右移动");
  573. this.setInputsInline(false);
  574. this.setPreviousStatement(true);
  575. this.setNextStatement(true);
  576. this.setColour("#1b5873");
  577. this.setTooltip("");
  578. this.setHelpUrl("");
  579. },
  580. };
  581. Blockly.JavaScript.iot_lcd_trunRightinit = function (block) {
  582. var _code = "trunRight=1;";
  583. return _code;
  584. };
  585. var that = this;
  586. window.addEventListener("message", function (e) {
  587. // 监听 message 事件
  588. if (e.data.success) {
  589. that.loading = true;
  590. that.$refs.unityvue.contentWindow.postMessage(
  591. { type: that.type },
  592. "*"
  593. );
  594. }
  595. if (e.data.active) {
  596. that.active = true;
  597. } else if (e.data.active != undefined) {
  598. that.active = false;
  599. }
  600. if (e.data.noCamera) {
  601. that.$message.error(e.data.noCamera);
  602. }
  603. });
  604. },
  605. },
  606. mounted() {
  607. this.blocklyInit();
  608. this.fnInit();
  609. this.videoEl = this.$refs.video;
  610. this.canvasEL = this.$refs.canvasDOM;
  611. },
  612. };
  613. </script>
  614. <style scoped>
  615. html,
  616. body {
  617. margin: 0;
  618. padding: 0;
  619. width: 100%;
  620. }
  621. .dialog_diy >>> .el-form-item__label {
  622. width: 50px !important;
  623. margin-left: 35px !important;
  624. }
  625. .dialog_diy >>> .el-form-item__content {
  626. margin-left: 0 !important;
  627. }
  628. .update {
  629. margin-left: 20%;
  630. font-size: 16px !important;
  631. }
  632. .tip {
  633. margin: 25px 0 30px 20px;
  634. }
  635. #fan > img,
  636. #fanB > img,
  637. #motor > img,
  638. #base > img,
  639. #line > img,
  640. .right > img,
  641. #a4 > img,
  642. #screan > img {
  643. width: 100%;
  644. height: 100%;
  645. user-select: none;
  646. }
  647. .img {
  648. display: flex;
  649. flex-direction: row;
  650. justify-content: flex-start;
  651. justify-content: center;
  652. width: 100%;
  653. height: 500px;
  654. position: relative;
  655. }
  656. #fan {
  657. width: 425px;
  658. position: absolute;
  659. z-index: 5;
  660. left: 150px;
  661. top: 0;
  662. transition: all 0.5s;
  663. transform: rotate(0deg);
  664. }
  665. #fanB {
  666. width: 116.6px;
  667. position: absolute;
  668. z-index: 4;
  669. left: 300px;
  670. top: 155px;
  671. }
  672. #base {
  673. width: 423.33px;
  674. position: absolute;
  675. z-index: 4;
  676. top: 295px;
  677. left: 0;
  678. }
  679. #motor {
  680. width: 134.16px;
  681. position: absolute;
  682. z-index: 3;
  683. left: 292px;
  684. top: 175px;
  685. }
  686. #a4 {
  687. width: 210px;
  688. position: absolute;
  689. z-index: 5;
  690. top: 517px;
  691. left: 111px;
  692. }
  693. #screan {
  694. width: 178.33px;
  695. position: absolute;
  696. left: -19px;
  697. top: 126px;
  698. }
  699. #line {
  700. width: 470.83px;
  701. position: absolute;
  702. z-index: 2;
  703. top: 245px;
  704. left: -113px;
  705. }
  706. .button {
  707. color: #fff;
  708. background: #8ca1de;
  709. width: 550px;
  710. height: 55px;
  711. font-size: 20px;
  712. text-align: center;
  713. line-height: 55px;
  714. position: absolute;
  715. bottom: 10%;
  716. left: 50%;
  717. transform: translateX(-50%);
  718. user-select: none;
  719. }
  720. .right {
  721. width: 40px;
  722. position: absolute;
  723. left: 55%;
  724. top: 70%;
  725. display: none;
  726. }
  727. .dark {
  728. background: #5b79d0;
  729. cursor: pointer;
  730. }
  731. .controlZ {
  732. width: 560px;
  733. height: 620px;
  734. /* margin-left: calc(50% - (490px / 2)); */
  735. position: relative;
  736. }
  737. .cameraZ {
  738. display: flex;
  739. height: 340px;
  740. flex-direction: column;
  741. flex-wrap: nowrap;
  742. width: 300px;
  743. }
  744. .cameraBtn {
  745. display: flex;
  746. flex-direction: column;
  747. align-items: center;
  748. }
  749. .cameraBtn button {
  750. margin: 0 0 10px 0;
  751. }
  752. .face {
  753. position: absolute;
  754. z-index: 9999;
  755. padding: 5px 0px;
  756. left: 0;
  757. top: 37px;
  758. }
  759. .kuang {
  760. position: absolute;
  761. z-index: 10000;
  762. padding: 26.5px 0;
  763. left: 0;
  764. top: 37px;
  765. }
  766. .pFace {
  767. /* width: 300px; */
  768. /* height: 240px; */
  769. width: 150px;
  770. margin: 0 auto;
  771. margin-top: 220px;
  772. }
  773. .close > img,
  774. .save > img,
  775. .pFace > img,
  776. .open > img,
  777. .spotPhoto > img {
  778. width: 100%;
  779. height: 100%;
  780. cursor: pointer;
  781. }
  782. .cameraBtn {
  783. margin-top: 80px;
  784. }
  785. .close {
  786. margin-bottom: 25px;
  787. }
  788. .isPhoto {
  789. height: 410px;
  790. padding: 80px 0 0 0;
  791. box-sizing: border-box;
  792. background: #fff;
  793. }
  794. .isPhoto > span {
  795. font-size: 25px;
  796. color: #ccc;
  797. margin-left: 10px;
  798. }
  799. .nav {
  800. text-align: center;
  801. font-size: 32px;
  802. color: #ccc;
  803. }
  804. .spot {
  805. background: #64ff64;
  806. color: #fff;
  807. width: 140px;
  808. height: 40px;
  809. text-align: center;
  810. line-height: 40px;
  811. border-radius: 20px;
  812. margin-top: 25px;
  813. cursor: pointer;
  814. display: none;
  815. }
  816. .spotNumber {
  817. text-align: center;
  818. margin: 0 auto;
  819. font-size: 20px;
  820. color: #8c8c8c;
  821. }
  822. .spotPhoto {
  823. width: 300px;
  824. height: 245px;
  825. }
  826. .spotPhoto {
  827. margin-top: 20px;
  828. font-size: 20px;
  829. }
  830. .gdt {
  831. display: flex;
  832. flex-direction: column;
  833. }
  834. .ablockly,
  835. #blocklyDiv {
  836. height: 100%;
  837. width: 100%;
  838. }
  839. .blocklySvg {
  840. height: 905px !important;
  841. }
  842. .ablockly {
  843. position: relative;
  844. }
  845. .container {
  846. width: 50%;
  847. height: 100%;
  848. min-width: 960px;
  849. }
  850. </style>