feng 发布的文章

threejs+vue3.0+typescript开发的大富翁小游戏

立了flag要在2021年开发一款3d休闲小游戏,勉强做了一个大富翁1.0,还有不少需要修改的地方,本来想修改完成后来发博客,下半年为了赚钱稍微忙了点...停了一段时间后就一直没继续了.
先发个github的地址链接,后面有时间,再发些文章记录一些开发web游戏的坑...

背包客自由行

游戏规则参考
https://j9981168.pixnet.net/blog/post/239327645

后面有时间在游戏里补上帮助(逃ε=ε=ε=┏(゜ロ゜;)┛)

在VBA变量中存储数组公式结果

之前在编写VBA程序时如果遇到需要用数组公式来计算结果的时候,我都会通过往单元格写入数组函数来得到数组函数的结果,然后获取单元格的内容将结果放到VBA变量中,这样做会导致VBA效率大大降低,一直以为没什么好办法,没想到偶然搜索找到了解决的办法:

代码如下:

Sub j2()
a = Application.Evaluate("SUM(((品名=""春羔皮"")*(规格=""1-2"")*(单价>100))*金额)")
 MsgBox a
End Sub

原文链接

CSS 毛玻璃特效开发

之前在我的博客中有写磨砂玻璃的效果开发,但是会存在很多的局限.
附上链接: 磨砂波理效果开发
最近发现css又多了个backdrop-filter的属性,能够非常简单的实现毛玻璃的效果.
真的是太感动了

附上效果图:
http://qn.fengyitong.name/backdrop-filter.png

附上官方文档说明:
https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#result

附上浏览器当前支持程度:
http://qn.fengyitong.name/can-i-use-backdrop-filter.png

顺便附上效果图参考代码(官方文档的示例代码)

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      background-color: rgba(255, 255, 255, 0.3);
      border-radius: 5px;
      font-family: sans-serif;
      text-align: center;
      line-height: 1;
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
      max-width: 50%;
      max-height: 50%;
      padding: 20px 40px;
    }

    html,
    body {
      height: 100%;
      width: 100%;
    }

    body {
      background-image: url(https://picsum.photos/id/1080/6858/4574), linear-gradient(rgb(219, 166, 166), rgb(0, 0, 172));
      background-position: center center;
      background-repeat: no-repeat;
      background-size: cover;
    }

    .container {
      align-items: center;
      display: flex;
      justify-content: center;
      height: 100%;
      width: 100%;
    }
  </style>
</head>

<body>
  <div class="container">
    <div class="box">
      <p>backdrop-filter: blur(10px)</p>
    </div>
  </div>
</body>

</html>

UNI-APP 签名画板封装

前段时间公司有需要用户签名的功能开发,我针对签字封装了一个组件,方便使用,在安卓,ios,h5,微信小程序中测试通过,其他环境未进行测试.
github地址:https://github.com/aoobao/signature

核心组件所在文件 components/SignaturePad/SignaturePad.vue

组件中有使用到uview-ui的popup组件,使用前需要引入uview组件库

https://www.uviewui.com/

基本使用方法

可参考页面 pages/index/index

将组件引入到template中

<template>
  <view>
    ....
        <signature-pad ref="signature"></signature-pad>
  </view> 
</template>

js代码调用

this.$refs.signature
  .sign({
    width: '700rpx',  // 画板宽度
    height: '500rpx', // 画板高度
    color: '#000'     // 画笔宽高
  })
  .then(path => {
    console.log(path); // 图片输出路径(h5页面为base64)
  })
  .catch(e => {
    console.log('取消签名', e);
  });

效果展示

https://aoobao.github.io/signature/signature.mp4