Code Monkey home page Code Monkey logo

raindrop-fx's People

Contributors

erjanmx avatar sardinefish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raindrop-fx's Issues

How to make background not blurry

Hello,

I had tried mist: false, but it seems not to remove background blurry. Please help to know how to make background clear. Thanks.

vue-cli 4.5项目导入出错

导入方式:
import RaindropFX from "raindrop-fx";

错误信息:

error  in ./node_modules/raindrop-fx/dist/index.js

Module parse failed: Unexpected token (396:4320)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     vWorldPos = (uTransformM * vec4(aPos, 1)).xyz;\r
|     vSize = aSize;\r`
······
| /*! *****************************************************************************
| Copyright (C) Microsoft. All rights reserved.

 @ ./node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/ts-loader??ref--14-2!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/components/background/Background.vue?vue&type=script&lang=ts 6:0-37 35:25-35

这是咋回事啊大佬

关于新版的问题

想点引用回复的,结果点到了重新开个issue。

Vite打包始终无法通过,dist里文件一直报

'default' is not exported by *******
2: import { normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue"
3: 
4: import RaindropFX from "raindrop-fx";
          ^
5: import { onBeforeUnmount, onMounted, ref } from "vue";

看源码应该是export了,但不能打包就很奇怪。源码改成export default RaindropFX 也没用。
直接拿源码用Vite打包的话,没有任何特效显示,控制台的log是有的,说明确实是实例化成功了,不过为什么没有效果,,等明天有空看看

然后拿example测试了一下destroy后,重新建canvas实例化。 背景图加载了,落雨没有渲染。
控制台的报错是

11 WebGL: INVALID_OPERATION: uniform1i: location not for current program
122 WebGL: INVALID_OPERATION: uniform4fv: location is not from current program
30 WebGL: INVALID_OPERATION: uniform1f: location not for current program
93 WebGL: INVALID_OPERATION: uniform2fv: location is not from current program

堆栈类似

uploadUniform material.ts:431
upload material.ts:134
drawMesh  renderer.ts:451
blit renderer.ts:317
downSample| blur.ts:73
blurBackground  renderer.ts:388
reloadBackground renderer.ts:329

实现原版RainEffect的鼠标效果

如题,应当怎样实现原版 RainEffect 的背景层固定,雨滴层随着鼠标的移动而移动的效果?尝试过设置 background 属性为全透明图片(雨滴显示是黑的)或者设置 canvas 元素的 opacity,并另外设置背景,效果不好,主要是雨滴的折射效果没有了。

It's broken in Safari iPhone?

It works great in the desktop browser but it wont render at all in iPhone Safari. Any suggestions?

It looks like Safari has WebGL2 as experimental...the original codrops article worked everywhere.

[Help Wanted, Question] How to disable blur and reduce GPU usage?

Hello, I'm trying to use your raindrop-fx as a wallpaper, however the GPU usage is very high, I assume (perhaps wrongly, not sure) that the blur effect in the code is eating up a huge amount of GPU, and I assume (perhaps wrongly, not sure) this can be entirely avoided by disabling this blur effect completely and just blurring the image in an image editor.

But it seems that disabling the blur is quite the challenge for me, I tried just setting both mistBlurStep and backgroundBlurSteps to 0
but that just causes the wallpaper to become completely black, I have tried looking in the code (index.js) for a solution to this black screen problem, but I could not find anything that worked,

Also, would disabling blur even reduce the GPU usage, or is it something else eating up the GPU? I have never coded in any programming language. I'm losing my sanity. Please save me.

canvas销毁后,object does not belong to this context

非常棒的项目。
我在vue3上使用raindrop-fx,正常情况下,raindrop-fx工作的非常好

但我尝试使用vue router作为前端路由,在路由跳转后跳回来,canvas被销毁然后重建,回来后canvas并不能正常渲染,只有黑白,背景图也没有渲染出来。控制台有很多诸如WebGL: INVALID_OPERATION: bindFramebuffer: object does not belong to this context的错误。

在调试跟踪,发现

        if (!GlobalContext())
            this.use();

GlobalContext()仍然为之前销毁的canvas的值,use()函数并没有运行,于是我尝试在这个代码运行时候下断,控制台调用了ZograRenderer的use函数,此时背景图成功渲染出来,但是落雨效果并没有渲染。控制台还是有很多WebGL: INVALID_OPERATION: bindFramebuffer: object does not belong to this context这样的类似的错误。

此时控制台输出错误的堆栈大概是,

bind  RainDrop.vue_vue_typ…3.js:formatted:7577
drawMeshProceduralInstance  RainDrop.vue_vue_typ…3.js:formatted:8057
drawDroplet   RainDrop.vue_vue_typ…3.js:formatted:9333
render   RainDrop.vue_vue_typ…3.js:formatted:9256
update  RainDrop.vue_vue_typ…3.js:formatted:9642

我觉得奇怪的是,如果context是错误的,背景图应该也不会渲染,context是正确的话,为什么落雨不渲染。我对webgl并不是很了解,不明白为什么会这样,请大佬解答。

Is it possible to remove the "fog"?

Love the rain effect however i want to have less fog, similar to this:
image

Is this possible? Ive tried to mess with some options but none of them changed the "fog"

在vue-cli构建的项目里我无法将它运行起来

App.vue

<template>
    <div class="App">

        <div id="root">
            <canvas id="canvas"></canvas>
        </div>

    </div>
</template>
<script>
import sal from "sal.js";
const RaindropFX = require("raindrop-fx");

export default {
    name: "App",
    mounted() {
        const canvas = document.querySelector("#canvas");
        const rect = canvas.getBoundingClientRect();
        canvas.width = rect.width;
        canvas.height = rect.height;
        const raindropFx = new RaindropFX({
            canvas: canvas,
            background: "./assets/background.jpg",
        });
        console.log(raindropFx);
        raindropFx.start();

        sal({
            once: false,
        });
    },
};
</script>
<style lang="less" scoped>
    #root{
        width: 100vw;
        height: 100vh;
        position: absolute;
        #canvas {
            width: 100%;
            height: 100%;
        }
    }
</style>

vue.config.js

const path = require('path')
module.exports = {
  chainWebpack: config => {
    config.module
      .rule('thejs')
      .test(/\.js$/)
      .use('babel-loader')
      .loader('babel-loader')
      .end()
  },
  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'less',
      patterns: [
        path.resolve(__dirname, "./src/theme/index.less")
      ],
    }
  },
  css: {
    loaderOptions: {
      less: {
        lessOptions: {
          javascriptEnabled: true
        }
      }
    }
  },
}

结果 https://z3.ax1x.com/2021/06/17/2vDiWt.png

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.