New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

duofen

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

duofen

``` npm install duofen ```

  • 0.0.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by14.29%
Maintainers
1
Weekly downloads
 
Created
Source

duofen

游戏

安装
npm install duofen
使用
必须开启 "enableSkia": "true"
  • json
{
    "usingComponents": {
        "game": "duofen/duofen"
    }
}
  • mini.project.json
{
  "node_modules_es6_whitelist": [
    "common-game"
  ]
}
  • js
Page({
  data: {
    gameSource: JSON.stringify({
      baseOps: {
        speed: { min: 5, max: 15, step: 0.01 },//移动速度
        firstY: 200,//首次加载游戏第一个元素的底部坐标位置
        intervalStep: 1,//两个物体之间的间隔递减值
        intervalStepH: 50,//移动指定距离递减一次
        minIntervalH: 300,//两个物体之间的最小间隔距离
        maxIntervalH: 500,//两个物体之间的间隔距离
      },
      energy: [
        { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01YHUZf41FJvdgJTfzx_!!1080040467.png", width: 129, height: 129, probability: 1, val: 10, scoreType: "add" },
        { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01yNOw5i1FJvdfUTF4C_!!1080040467.png", width: 127, height: 126, probability: 1, val: 10, scoreType: "add" },
        { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01Dxe0Y91FJvdZrzHmO_!!1080040467.png", width: 191, height: 191, probability: 1, val: 10, scoreType: "add" },
        { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01C7h5pn1FJvdgu93JM_!!1080040467.png", width: 84, height: 85, probability: 1, val: 10, scoreType: "add" },
        { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN015Q8jih1FJvddngySn_!!1080040467.png", width: 201, height: 202, probability: 1, val: 10, scoreType: "add" },
        { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN011pxV4u1FJvddIuoEq_!!1080040467.png", width: 194, height: 196, probability: 1, val: 10, scoreType: "add" },
        { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01l8Wd861FJvddngIrl_!!1080040467.png", width: 161, height: 160, probability: 1, val: -5, scoreType: "reduce" },
      ],
      timePos: {
        bgAni: {
          x: 750 / 2,
          y: 800 - 299 / 2,
          srcArr: [
            { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01kdrZJd1FJvdfUe3Ew_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01zbko0W1FJvdcWujs0_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01KY60hb1FJvdRIBhDo_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01jGVaXD1FJvddJ5YHB_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01fukUvB1FJvdZw1cqN_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN010fEIQm1FJvdenePPH_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01GCSXUm1FJvddJ5YHL_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN013k5Ntc1FJvddnqZqG_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01LYDrJO1FJvddnrqrs_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01xEtWOn1FJvdZs9xcF_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01tryUj41FJvdZs9YhD_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01SRMTAP1FJvdaOgLTJ_!!1080040467.png", width: 358, height: 299 },
            { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN010jgTLQ1FJvdb6zp08_!!1080040467.png", width: 358, height: 299 },
          ]
        },
        align: "center",
        x: 750 / 2,
        y: 800 - 299 / 2,
        time: 6,//倒计时时间
        // 时间数字图片 0 - 9
        numOffset: 30,//数字两边空白太多,增加偏移量
        numArr: [
          { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN011sHu9n1FJvdgKI5rp_!!1080040467.png", width: 68, height: 82, val: 0 },
          { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01V0SAVQ1FJvdRIlgHa_!!1080040467.png", width: 68, height: 82, val: 1 },
          { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01VV492i1FJvdgKFse2_!!1080040467.png", width: 68, height: 82, val: 2 },
          { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01kHgbxq1FJvdXNNd0J_!!1080040467.png", width: 68, height: 82, val: 3 },
          { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01BQF0To1FJvdW2KcLo_!!1080040467.png", width: 68, height: 82, val: 4 },
          { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01qsXw9l1FJvddJenbE_!!1080040467.png", width: 68, height: 82, val: 5 },
          { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01BrICVe1FJvdW2LHuT_!!1080040467.png", width: 68, height: 82, val: 6 },
          { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01SrLriU1FJvdeoJE0h_!!1080040467.png", width: 68, height: 82, val: 7 },
          { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01ORkx7V1FJvdRIn5bu_!!1080040467.png", width: 68, height: 82, val: 8 },
          { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN010KzKdz1FJvdZwcTwt_!!1080040467.png", width: 68, height: 82, val: 9 },
        ],
        // 尾巴
        tail: { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN0115ucXJ1FJvdW42Dne_!!1080040467.png", width: 68, height: 82 }
      },
      scorePos: {
        x: 750 / 2,
        y: 200,
        fadeTime: 500,
        numOffset: 0,
        before: {
          add: { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN017c3LC71FJvddJzXkh_!!1080040467.png", width: 28, height: 43 },
          reduce: { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01dILbNH1FJvdZt6yHo_!!1080040467.png", width: 28, height: 43 },
        },
        numArr: [
          { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01URyJ681FJvdZt6EYc_!!1080040467.png", width: 28, height: 43, val: 0 },
          { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN011ijqSv1FJvdgKcEZz_!!1080040467.png", width: 28, height: 43, val: 1 },
          { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01IKHtLM1FJvdcXpT98_!!1080040467.png", width: 28, height: 43, val: 2 },
          { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01KXPB8C1FJvdgKaQKO_!!1080040467.png", width: 28, height: 43, val: 3 },
          { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN012Pl3fT1FJvdW2dcEW_!!1080040467.png", width: 28, height: 43, val: 4 },
          { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01qh9wDG1FJvdaPct6B_!!1080040467.png", width: 28, height: 43, val: 5 },
          { src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01pVG9ny1FJvddK0cGl_!!1080040467.png", width: 28, height: 43, val: 6 },
          { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN015bn9Se1FJvdXNhhYx_!!1080040467.png", width: 28, height: 43, val: 7 },
          { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01R0s5Ld1FJvdeodler_!!1080040467.png", width: 28, height: 43, val: 8 },
          { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01OAg3Rk1FJvdZt7Euk_!!1080040467.png", width: 28, height: 43, val: 9 },
        ]
      }
    }),
  },
  onLoad(query) {
  },

  playFun() {
    this.gameComponent.onEvent("start");
  },
  resetFun() {
    this.gameComponent.onEvent("reset");
  },

  onRef(game) {
    this.gameComponent = game;
    console.log("进入游戏")
  },
  onInitDone() {
    // my.alert({
    //   content: "游戏初始化完成"
    // })
    this.playFun();
  },
  onUpdate(ops) {
    // { totalScore: 0, imgObj: { } }
    console.log(ops)
  },
  onGameOver(totalScore) {
    console.log(totalScore)
  }
})
  • xaml
  <duofen gameSource="{{gameSource}}" 
    onRef="onRef"
    onInitDone="onInitDone" 
    onUpdate="onUpdate" 
    onGameOver="onGameOver"
    />

FAQs

Package last updated on 27 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc