Comments (1)
Even by being more faithful to what is in storybook, still not getting the project:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.12.11/paper-full.min.js"></script>
<title>Chat Bubbles</title>
</head>
<body>
<div id="chat-bubble">
</div>
<script type="module">
import { Comical, Bubble } from 'https://cdn.skypack.dev/comicaljs';
paper.install(window);
const wrapDiv = document.createElement("div");
wrapDiv.style.position = "relative";
wrapDiv.style.height = "600px";
const canvas = document.createElement("canvas");
canvas.height = 500;
canvas.width = 500;
wrapDiv.appendChild(canvas);
paper.setup(canvas);
const textDiv2 = document.createElement("div");
textDiv2.innerText =
"This is a text block meant to represent shouting. It is 200px wide. It has a bit more text to make it squarer.";
textDiv2.style.width = "200px";
textDiv2.style.textAlign = "center";
//textDiv2.style.backgroundColor = "pink";
textDiv2.style.position = "absolute";
textDiv2.style.top = "250px";
textDiv2.style.left = "120px";
wrapDiv.appendChild(textDiv2);
const bubble = new Bubble(textDiv2);
bubble.setBubbleSpec({
version: "1.0",
style: "shout",
tails: [{ tipX: 420, tipY: 400, midpointX: 320, midpointY: 375 }],
level: 1
});
setTimeout(() => {
bubble.initialize();
}, 200);
document.getElementById("chat-bubble").appendChild(wrapDiv);
</script>
</body>
</html>
from comical-js.
Related Issues (14)
- Support child bubbles
- Simple Puckered Exclamation Bubble HOT 1
- Gradient Backgrounds
- Multiple (or zero) tails.
- Thought bubble with bubble tail
- (low) Limit tail midpoint handle to valid curves.
- Limit all tail handles to stay outside of the bubble (or at least the wrapped text element).
- (low) Add borderStyle property
- Add bubble `level` or ordering
- fillColor
- Rectangular bubbles HOT 1
- Standalone comical-js samples HOT 4
- Advanced Puckered Exclamation Bubble HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comical-js.