• Stars
    star
    1,617
  • Rank 28,943 (Top 0.6 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Beautiful bubbly backgrounds in less than 1kB (750 bytes gzipped)

bubbly-bg

Beautiful bubbly backgrounds in less than 1kB (750 bytes gzipped).

Usage

Add bubbly to your webpage and call bubbly():

<body>
  ...
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/bubbly-bg.js"></script>
  <script>bubbly();</script>
</body>

Bubbly creates a canvas element and appends it to the body. This element has position: fixed and z-index: -1, and always fills the width/height of the viewport, which should make it plug and play for most projects.

You can also use bubbly with a canvas you create yourself, by including {canvas: yourCanvas} in the configuration.

Live demo: https://tipsy.github.io/bubbly-bg

Config generator: https://tipsy.github.io/bubbly-bg/generator

Gif demo:

Bubbly animated

PNG demo:

Bubbly examples

Installation

Configuration / Docs / Options

bubbly({
    canvas: document.querySelector("#background"), // default is created and attached automatically
    compose: "lighter", // default is "lighter"
    animate: false, // default is true
    bubbles: Math.random() * 100, // default is Math.floor((canvas.width + canvas.height) * 0.02);
    shadowColor: "#0ff", // default is #fff
    shadowBlur: 1, // default is 4
    fillFunc: () => `hsla(${Math.random() * 360}, 100%, 50%, ${Math.random() * 0.25})`, // default is () => `hsla(0, 0%, 100%, ${r() * 0.1})`)
    angleFunc: () => Math.random() * Math.PI * 2, // default is this
    velocityFunc: () => 0.1 + Math.random() * 0.5, // default is this
    radiusFunc: () => 4 + Math.random() * 25 // default is 4 + Math.random() * width / 25
});

Config from examples

Blue with white bubbles

bubbly();

Black/red with red bubbles

bubbly({
    gradientStart: "#111",
    gradientStop: "#422",
    fillFunc: () => `hsla(0, 100%, 50%, ${Math.random() * 0.25})`
});

Purple with multicolored bubbles

bubbly({
    gradientStart: "#4c004c",
    gradientStop: "#1a001a",
    fillFunc: () => `hsla(${Math.random() * 360}, 100%, 50%, ${Math.random() * 0.25})`
});

Yellow/pink with red/orange/yellow bubbles

bubbly({
    gradientStart: "#fff4e6",
    gradientStop: "#ffe9e4",
    shadowBlur: 1,
    compose: "source-over",
    fillFunc: () => `hsla(${Math.random() * 50}, 100%, 50%, .3)`
});

More Repositories

1

profile-summary-for-github

Tool for visualizing GitHub profiles
Vue
19,841
star
2

j2html

Java to HTML generator. Enjoy typesafe HTML generation.
Java
760
star
3

spark-basic-structure

Example of one possible way of structuring a Spark application
Java
125
star
4

spark-websocket

Chat application tutorial using Spark and WebSockets
Java
69
star
5

loomylin

Java
45
star
6

kotlin-admin-template

Kotlin
41
star
7

isometric-tiles

Isometric landscape tiles (grass, arid, desert, snow) + decorations.
39
star
8

spark-file-upload

Java
26
star
9

spark-kotlin

Kotlin
26
star
10

javalin-website-example

Java
24
star
11

spark-ssl

Simple example showing how to set up SSL with Spark
Java
19
star
12

spark-intercooler

TodoMVC usin intercooler.js and Spark
Java
19
star
13

javalin-kotlin-example

Kotlin
17
star
14

javalin-realtime-collaboration-example

HTML
16
star
15

javalin-websocket-example

Java
16
star
16

spark-heroku-example

Tutorial explaining how to deploy Spark apps to Heroku
Java
16
star
17

javalinvue-example

Vue
15
star
18

javalinstagram

Vue
11
star
19

javalin-async-example

HTML
9
star
20

javalin-vuejs-example

JavaScript
9
star
21

javalin-auth-example

Kotlin
8
star
22

javalin-openapi-example

Java
6
star
23

javalin-testing-example

Java
5
star
24

javalin-html-forms-example

HTML
5
star
25

omeglin

JavaScript
4
star
26

javalin-jetty-sessions-example

Java
3
star
27

javalin-heroku-example

Java
3
star
28

dat-bodycontent

Example showing how to use Apache Velocity and the $bodyContent variable with Spark
Java
2
star
29

javalin-email-example

Java
2
star
30

twistrating

Java
2
star
31

jvm-brotli-example

Example showing how to use jvm-brotli (https://github.com/nixxcode/jvm-brotli)
Java
2
star
32

javalin-prometheus-example

Java
1
star
33

tipsydialog

JavaScript
1
star
34

javalin-cors-example

Kotlin
1
star
35

minecraft-vue-components

1
star
36

aaliyah

JavaScript
1
star
37

masteroppgave

Java
1
star