GithubHelp home page GithubHelp logo

bradley / blotter Goto Github PK

View Code? Open in Web Editor NEW
3.0K 39.0 210.0 10.71 MB

A JavaScript API for drawing unconventional text effects on the web.

Home Page: https://blotter.js.org

License: Other

JavaScript 100.00%
webgl glsl glsl-shaders javascript typography text css animation design creative-coding

blotter's Introduction

Blotter logo

A JavaScript API for drawing unconventional text effects on the web.

HomeHelp

Overview

When applying effects to text on the web, designers have traditionally been constrained to those provided by CSS. In the majority of cases this is entirely suitable – text is text right? Yet still, there exist numerous examples of designers combining CSS properties or gifs and images to create effects that evoke something more playful. Precisely here, Blotter exists to provide an alternative.

GLSL Backed Text Effects with Ease

Blotter provides a simple interface for building and manipulating text effects that utilize GLSL shaders without requiring that the designer write GLSL. Blotter has a growing library of configurable effects while also providing ways for student or experienced GLSL programmers to quickly bootstrap new ones.

Atlasing Effects in a Single WebGL Back Buffer

Blotter renders all texts in a single WebGL context and limits the number of draw calls it makes by using atlases. When multiple texts share the same effect they are mapped into a single texture and rendered together. The resulting image data is then output to individual 2d contexts for each element.

Animation Loop

Rather than executing on a time based interval, Blotter's internal animation loop uses requestAnimationFrame to match the browser's display refresh rate and pause when the user navigates to other browser tabs; improving performance and preserving the battery life on the user's device.

What Blotter Isn't

Any texts you pass to Blotter can be individually configured using familiar style properties. You can use custom font faces through the @font-face spec. However, Blotter ultimately renders the texts passed to it into canvas elements. This means rendered text won't be selectable. Blotter is great for elements like titles, headings, and texts used for graphic purposes. It's not recommended that Blotter be used for lengthy bodies of text, and should in most cases be applied to words individually.

Usage

Download the minified version.

To apply text effects, you'll also want to include at least one material, so download one of Blotter's ready-made effects, such as the ChannelSplitMaterial.

Include both in your HTML.

<script src="path/to/blotter.min.js"></script>
<script src="path/to/channelSplitMaterial.js"></script>

The following illustrates how to render Blotter's ChannelSplitMaterial in the body of your page with default settings.

<!doctype html>
<html>
  <head>
    <script src="path/to/blotter.min.js"></script>
    <script src="path/to/channelSplitMaterial.js"></script>
  </head>
  <body>
    <script>
      var text = new Blotter.Text("Hello", {
        family : "serif",
        size : 120,
        fill : "#171717"
      });

      var material = new Blotter.ChannelSplitMaterial();

      var blotter = new Blotter(material, { texts : text });

      var scope = blotter.forText(text);

      scope.appendTo(document.body);
    </script>
  </body>
</html>

Making Changes / Custom Builds

Firstly, install Blotter's build dependencies (OSX):

$ cd ~/path/to/blotter
$ npm install

The blotter.js and blotter.min.js files are built from source files in the /src directory. Do not edit these built files directly. Instead, edit the source files within the /src directory and then run the following to build the generated files:

$ npm run build

You will the updated build files at /build/blotter.js and /build/blotter.min.js.

Without Three.js / Without Underscore.js

Blotter.js requires Three.js and Underscore.js. If you're already including these files in your project, you should remove them from the defFiles array in the Gruntfile and re-run the build script.

Note: In order to decrease the total build size, Blotter uses a custom build of Three.js that only includes modules Blotter.js relies on. For more information view the build-custom-three script in package.json.

Custom Materials

The documentation for creating custom materials can be found in the Wiki.

Credits

Blotter is not possible without these contributions to JavaScript.


Some projects and people who have helped inspire along the way.

  • Two.js
    Jono Brandel's Two.js has provided much inspiration for Blotter's documentation and API design.
  • Reza Ali
    Reza's Fragment was a fundamental part of the development process for writing Blotter's Fragment shaders, and Reza kindly allowed Blotter to include an array of shader helper functions from Fragment.
  • Mitch Paone
    I was introduced to Mitch's work in computational typography while working on Blotter, and the work Mitch has done with DIA has been hugely motivational.
  • Stan Haanappel
    Stan Haanappel is a designer whose work with type has been inspirational to Blotter.
  • The Book of Shaders
    The Book of Shaders by Patricio Gonzalez Vivo and Jen Lowe is where anyone looking to learn more about writing shaders should begin.
  • Shadertoy
    Shadertoy has been a critical part of my personal learning experience while working on Blotter.


✌️ - Bradley Griffith

blotter's People

Contributors

0xflotus avatar bradley 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  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

blotter's Issues

Font Loading behaving strangely with multiple fonts

I don't believe font loading is happening properly.

I specify two fonts in my blotter script (ripple.js) as follows:

textOptions1 = {
      family: "'gtf_adieu_trialbold', serif",
      size: _width < 1000 ? 50 : _width < 1300 ? 75 : 90,
      fill: "#220032",
      paddingLeft: 20,
      paddingRight: 20,
    };
  
    textOptionsOutline1 = {
      family: "'gtf_adieu_trialbold-outline'",
      size: _width < 1000 ? 50 : _width < 1300 ? 75 : 90,
      fill: "#220032",
      paddingLeft: 20,
      paddingRight: 20,
    };

But when I attempt to use these fonts, only the solid, not outline fonts are visible:

Screen Shot 2019-09-30 at 6 04 23 PM

I can change a completely unrelated part of my site's stylesheet (main.css), and then only the outline font shows, not the solid font.

So for example this class (which is not a blotter element:

.f__outline { font-family: 'gtf_adieu_trialbold-outline' } would show the solids and not the outline,
but this: .f__outline { font-family: 'gtf_adieu_trialbold-outline !important' } would show the outline not the solids.

Screen Shot 2019-09-30 at 6 05 49 PM

But I can never get both fonts to show as they should (top and bottom lines solid, middle line outline.

Attaching my current script.
ripple.js.zip

Animation resets when text changes

I'm using LiquidDistortMaterial for a text, and whenever I change the content, the animation restarts making it very unpleasent. Is there any workaround to avoid this reset? Maybe an offset animation start parameter?

This is my normal text changing code
blotterText.value = text;
blotterText.needsUpdate = true;

Publish materials to npm

Now blotter package doesn't have materials in npm https://npmfs.com/package/blotter.js/0.1.0/, only a single build. That makes impossible to use it via unpkg CDN:

<script src="https://unpkg.com/blotter.js"></script>
<sctipt type="module">
console.dir(Blotter)
</script>

Can you please possibly publish full build folder?

Add more CSS properties

I am looking into using more CSS properties like:

var text = new Blotter.Text("observation", {
  vertical-align: middle,
  mix-blend-mode: multiply
});

Did not find anything in the docs to add custom props. Any plans to add this feature?

poor mobile performance

Mobile performance is so poor on animating.
Are you planning to improve it or is there a todo list for v2.0.0 so we can help to improve?

btw, good job! :)

Gradient color

Hello! Thank you for Blotter, it's really amazing! Is it possible to set gradient color on text?

Custom Font

Hey there, thanks for this great library. Quick question, I want to load a custom font from typekit. How might I add that to this example: https://codepen.io/SimonEvans/pen/PQKgyQ

Also how can I make sure it scales responsively? Thanks for your help!

Webpage not showing in Safari / macOS

https://blotter.js.org is not showing in Safari / macOS.
The console shows:

[Error] THREE.WebGLRenderer: Error creating WebGL context.
	ub (blotter-site.min.js:32:112974)
	(anonymous function) (blotter-site.min.js:32:354127)
	Global Code (blotter-site.min.js:32:354235)
[Error] TypeError: null is not an object (evaluating 'a.getExtension')
	get (blotter-site.min.js:32:93895)
	c (blotter-site.min.js:32:98209)
	ub (blotter-site.min.js:32:113069)
	(anonymous function) (blotter-site.min.js:32:354127)
	Global Code (blotter-site.min.js:32:354235)

hope that helps somehow

Uncaught TypeError: Cannot read property 'prototype' of undefined

I try to use Blotter.js but I get this error 'Uncaught TypeError: Cannot read property 'prototype' of undefined'

Console
blotter.min.js:1 Uncaught TypeError: Cannot read property 'prototype' of undefined
at blotter.min.js:1
at blotter.min.js:1
(anonymous) @ blotter.min.js:1
(anonymous) @ blotter.min.js:1

liquidDistortMaterial.js:7 Uncaught TypeError: Cannot read property 'prototype' of undefined
at liquidDistortMaterial.js:7
at liquidDistortMaterial.js:48

npm install

How can I install with npm to use with webpack? I am not sure I saw it in the documentation.

Uncaught DOMException: Failed to construct 'ImageData': The input data length is not a multiple of 4.

As far as I can tell, this error appears in every implementation I've seen of blotter, except for blotter's website.

Following the instructions given under the 'Basics', this error appears, and it seems to be preventing any rendering at all of Blotter.

Examples of this error occurring, from looking at codepen:

https://codepen.io/SimonEvans/pen/PQKgyQ?q=blotter&limit=all&type=type-pens

https://codepen.io/cristigoia/pen/ZrJPyv?q=blotter&limit=all&type=type-pens

https://codepen.io/tomvb/pen/QQMYQW?q=blotter&limit=all&type=type-pens

Blotter still doesn't work with custom fonts

Hi,

Thanks for the awesome plugin - the only issue I have is with custom fonts such as Google Fonts.

I followed your example mentioned here, but it doesn't seem working.
The strangest thing is that sometimes it works, then next time (refresh) it doesn't. The working example is here:
https://twirling.space/playground/uiscape/treejs/blotter/ - Blotter still displays a serif font, but the family property is set to "'Roboto Mono'" in the text options. The init is within a document.fonts.ready callback, and the Google Fonts scripts/styles also seem to be called correctly.

Also - while you expressed clearly that you don't intend to improve Blotter's custom font handling, I'm a little bit lost here.
Blotter is all about display, style, and modern typo effects - it seems to me that if custom fonts are not fully and reliably supported, it kinda questions the purpose of the script.

What do you think?
Thanks for taking a look into this.

Documentation for Custom Fonts

Hi - just trying to get a local font to work in Blotter. My utilization of the font in CSS is as follows:

@font-face {
  font-family: 'gtf_adieu_trialbold';
  src: url('../fonts/gtfadieutrial-bold-webfont.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

Does blotter utilize the CSS font face somehow? Or is there something specific I need to do to make that available to JS?

reduce the font size on tablet and mobile

Hy there

I tried to reduce the font size by using media queries but could not find a way to do it.

const createBlotterText = () => {
    const text = new Blotter.Text(textEl.innerHTML, {
        family : "'Playfair Display',serif",
        weight: 900,
        size : 150,
        paddingLeft: 100,
        paddingRight: 100,
        paddingTop: 100,
        paddingBottom: 100,
        fill : 'white'                      
    });
     function myFunction(x) {
        if (x.matches) { // If media query matches
          createBlotterText.size = 60;
        } 
      var x = window.matchMedia("(max-width: 768px)");
      myFunction(x) // Call listener function at run time
      x.addListener(myFunction) // Attach listener function on state changes
    };

I tried different version of this media query in java and css but failed to do so. Any help will be highly appreciated.

Intended way to update text

Hey there! I'm trying to figure out how to change the text rendered on screen in a more dynamic way. Your documentation mentions a couple times that you simply just call blotter.needsUpdate = true, but it never provides an example of how to do so.

Essentially what I'm after is an interface with a text input box. When the user hits enter on the box, the text will be sent to blotter to render. The only way I've been able to do it so far, is to keep appending new scopes to the screen. I feel like I'm missing something, or is this how you intended things to work? Here's a little example written the p5js editor. Every click will add a new scope to the window. I know that I could keep track of the old scopes and remove them as I get new submissions, but I feel like there has to be a way to tell blotter to just redraw the text texture.

Can you give some clarity or guidance on how to do this kind of update?

Is it possible to change ratio dynamically?

In order to reach a better performance on retina I would like to set the ratio only on certain points of my animation. Could anybody tell me if it is possible? Just using blotter.ratio = 1 after the blotter setup doesn't seem to work.

Thank you again!

ES Module

Sorry, just saw previous issue explaining why this isn't available.

needsUpdate seems not working

Hi, I'm new to both threejs and Blotter!
After I read document about it and I intend to change some uniforms of FliesMaterial but it doesn't look like working

The overall structure is composed with init, animate, and render function as below.

var blotter, blotterMaterial;
var time = 0.0;
function init(){
  var text = new Blotter.Text("0.2", {
    family: "serif",
    size: 120,
    fill: "#171717"
  });

  blotterMaterial = new Blotter.FliesMaterial();
  blotterMaterial.uniforms.uPointCellWidth = { type: "1f", value: 0.01 }; // (R, G, B)

  blotter = new Blotter(blotterMaterial, { texts: text });

  var scope = blotter.forText(text);
  scope.appendTo(document.body);
}

function animate(){
  requestAnimationFrame(animate);
  render();
}
function render() {
  var delta = clock.getDelta();
  time += delta;
  if (blotterMaterial) {
    blotter.material.uniforms.uPointCellWidth.value += 0.01;
    blotter.material.needsUpdate = true;
  }
}

Based on documentation, I understood needsUpdate can be called across blotter, material and so on. I tried call needsUpdate as true with my blotter instance but also blotterMaterial but it didn't work.

What mistake that I made?
Thanks.

liquidDistort up and down instead of horizontally

Hi - is there a way to distort the text up and down instead of side to side with the liquidDistortMaterial?

Here's a reference of what I'd like to do

I'm looking at the script - not too familiar with shader language, but I see:

"void mainImage( out vec4 mainImage, in vec2 fragCoord )",
        "{",
        "    // Setup ========================================================================",

        "    vec2 uv = fragCoord.xy / uResolution.xy;",
        "    float z = uSeed + uGlobalTime * uSpeed;",

        "    uv += snoise(vec3(uv, z)) * uVolatility;",

        "    mainImage = textTexture(uv);",

        "}"

so I imagine somewhere in that vec2 is the x and y coordinate?

Didn't see anything in the options:

uSpeed : { type : "1f", value : 1.0 },
          uVolatility : { type : "1f", value : 0.15 },
          uSeed : { type : "1f", value : 0.1 }

Documentation web site doesn't work under Chrome/Linux

This is how the page renders: screenshot. As you can see, most of the content is missing.

There seems to be an error in the dev console, which I suspect to be the cause:

Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
3blotter-site.min.js:32 THREE.WebGLRenderer 89
3blotter-site.min.js:32 Uncaught DOMException: Failed to construct 'ImageData': The input data length is not a multiple of 4.
    at a.Renderer.setSize (https://blotter.js.org/dist/blotter-site.min.js:32:402713)
    at a.Renderer.set width [as width] (https://blotter.js.org/dist/blotter-site.min.js:32:401862)
    at a.<anonymous> (https://blotter.js.org/dist/blotter-site.min.js:32:351011)
    at D (https://blotter.js.org/dist/blotter-site.min.js:32:7597)
    at https://blotter.js.org/dist/blotter-site.min.js:32:7799
    at https://blotter.js.org/dist/blotter-site.min.js:32:1228
    at a.<anonymous> (https://blotter.js.org/dist/blotter-site.min.js:32:350724)
    at D (https://blotter.js.org/dist/blotter-site.min.js:32:7597)
    at https://blotter.js.org/dist/blotter-site.min.js:32:7799
    at https://blotter.js.org/dist/blotter-site.min.js:32:1228

Design

  • [] Code editor
  • [] editor output
  • [] packs/pack documentation
  • [] download area. mininfied and not, sizes, dependencies
  • [] headings and subheadings
  • [] links and buttons
  • [] introduction section
  • [] basic usage section
  • [] documentation section
  • [] packs section
  • [] credits section
  • [] project section(??)

Edge Support?

Blotter has text sizing errors when used on Microsoft Edge. These same issues don't exist when used in Firefox and

Underscore JS known vulnerability

Hey love this library!

I recently noticed a known vulnerability is being flagged up in Lighthouse (Dev Tools) as part of the inclusion of Underscore.js.

Any chance this could be updated to patch the vulnerability?

Screenshot 2022-12-19 at 02 39 03

Thanks!

Just text?

Is this just for text?
Would love to add this effect to other elements.

Responsive font size

Hey,

I am trying to make my blotter.js text responsive, using something like the below CSS,
that ordinarily works:

font-size: calc(30px + 56 * ((100vw - 420px) / 860));

Because the size is declared in Javascript (currently set to 94), I haven't been able to apply the above.

I'm hoping for something like this:

var text = new Blotter.Text("Hello", {
        family : "serif",
        size :"calc(30px + 56 * ((100vw - 420px) / 860))",
        fill : "#171717"
});

Please can you advise?

Thank you!

Flies Material working in iOS Chrome and Safari but not in Android Chrome

Hi
I made a Blotter using Flies Material. It works in iOS but in my Galaxy A10 using Chrome I can't see nothing, this error reported "Blotter.Material: uniform value not valid for uniform type: 2f" but in iOS works.

`
var size = 100;
var uPointCellWidth = 0.007;
var uPointRadius = 0.90;

blotter_js_obj.setBlotterFlies(
'sample_test',
'.home-section-blotter-mc',
size, //size
uPointCellWidth, //uPointCellWidth
uPointRadius, //uPointRadius
0.77, //uDodgePosition
0.77, //uDodgeSpread
4.02 //uSpeed
);

setBlotterFlies: function (string, container, size, uPointCellWidth, uPointRadius, uDodgePosition, uDodgeSpread, uSpeed) {

    var text = new Blotter.Text(string, {
        family: "serif",
        size: size,
        fill: '#000000',
        paddingLeft: 40,
        paddingRight: 40
    })
    
    var material = new Blotter.FliesMaterial();
    
    material.uniforms.uPointCellWidth.value = uPointCellWidth;
    material.uniforms.uPointRadius.value = uPointRadius;
    material.uniforms.uDodgePosition.value = uDodgePosition;
    material.uniforms.uDodgeSpread.value = uDodgeSpread;
    material.uniforms.uSpeed.value = uSpeed;
    
    
    var bmaterial = new Blotter(material, {
        texts: text
    });
    
    var container1 = document.querySelector(container);
    
    var bScopeL = bmaterial.forText(text);
    
    bScopeL.appendTo(container1);

}

`

What's the problem?
Thanks

Blotter Text not working correctly, is anything outdated?

Im trying to render a text with a "RollingDistortMaterial" material.

In my computer it works correctly, without any issues or warnings:
image

This is the code:

    let fontContainer = document.querySelector("#blotter-text")
    let fullText = fontContainer.innerText.toUpperCase()
    fontContainer.innerText = "";

    fullText = fullText.split(" ")
    fullText.forEach(function (e) {
        convertToBlotter(e)
    })

    function convertToBlotter(word) {
        let text = new Blotter.Text(word, {
            family: "Media Sans Extended",
            size: 66.5,
            needsUpdate: true,
            fill: "#FFFFFF",
            leading: "1",
            paddingLeft: 10,
            paddingRight: 10
        });

        let material = new Blotter.RollingDistortMaterial();

        let blotter = new Blotter(material, { 
            texts: text 
        });

        blotter.needsUpdate = true;
        let scope = blotter.forText(text);

        scope.appendTo(fontContainer);
    }

But in other computers it gets this errors and warnings,
am i doing anything wrong? is anything outdated?

image

Line Breaks

Super cool project, thank you for making it :)
I understand that Blotter is made for large headers not for whole sentences but is there no way to use this on a few words on multiple lines?

Not much vertical distortion with a long string of text

Hi - I'm trying to achieve a sort of flag waving effect on my text. I noticed the example for the liquidDistortionMaterial has quite a bit of up and down movement, but it seems when you have a longer string of text there's not a lot of vertical movement (none, really).

Is there any way to exaggerate the up and down movement? Maybe even by editing the material? Here's what happens currently:

wave

multiline text, or copies of the same line of text

Hi - I want to achieve this effect:

Screen Shot 2019-09-25 at 5 43 48 PM

where I have multiple copies of the same line of text (or copies of the canvas, etc). I can get blotter to work on a single line of text, but I've tried numerous methods of creating a copy and non of them work.

For example:

<div id="distortion-text1" class="progress__content"></div>
<div id="distortion-text2" class="progress__content"></div>
<div id="distortion-text3" class="progress__content"></div>

and

var elem1 = document.getElementById('distortion-text1')
var elem2 = document.getElementById('distortion-text2')
var elem3 = document.getElementById('distortion-text3')
var scope1 = blotter.forText(text);
var scope2 = blotter.forText(text);
var scope3 = blotter.forText(text);

scope1.appendTo(elem1);
scope2.appendTo(elem2);
scope3.appendTo(elem3);

I've also just tried cloning the canvas and that doesn't work. Blotter seems to just append one single canvas to the last dom node (distortion-text3), no matter what I do.

svg logo

how to use the SVG logo image inside? Does this apply to text only?

Very long text breaks if the Text is longer than the Viewport

Hey, there you should set the style property whiteSpace to "nowrap",
otherwise the Block for very long texts breaks after the Viewport width.

// Determines size of text within the document given certain style properties

sizeForText : function(textValue, properties) {
// Using a here may not be the best approach. In theory a user's stylesheet
// could override the necessary styling for determining sizes below. With growing
// support for custom tags in html, we may consider using them if this raises problems.
var el = document.createElement("span"),
size;

properties = this.ensurePropertyValues(properties);

el.innerHTML = textValue;
el.style.display = "inline-block";
el.style.fontFamily = properties.family;
el.style.fontSize = properties.size + "px";
el.style.fontWeight = properties.weight;
el.style.fontStyle = properties.style;
el.style.lineHeight = properties.leading;
el.style.maxWidth = "none";
el.style.padding = this.stringifiedPadding(properties);
el.style.position = "absolute";
el.style.width = "auto";
el.style.visibility = "hidden";
el.style.whiteSpace = "nowrap";

additional text decoration

What other attributes are available for additional text decoration? Like if I wanted to outline the text, or fill with a gradient or even an image? Anyone have any thoughts on how to do this?

Controls Documentation

Hi,

Was just wondering if there was any documentation for controls on the text element e.g. on the home page being able to determine colour split location dependant on mouse action. I've looked but can't seem to find anything regarding this, sorry if I've missed it. Any help would be appreciated.

Thanks in advance, Mike. #

Blotter has build issues on Firefox Nightly (FF60) & Firefox Developer (FF59)

The bug is a little intermittent and needs some investigating. On the most recent versions of Firefox it seems that if you load into http://blotter.js.org with a fresh cache the page will mostly not load Blotter elements on the first load. A refresh seems to fix it. Additionally if you load up a material page (https://blotter.js.org/#/materials/FliesMaterial) first, with a fresh cache, Blotter seems to work fine and you can navigate to the homepage with everything working as usual.

Please investigate.

Reference comment on Designer News

'No loop' parameter

Is there a parameter to avoid the loop in slidingDoorMaterial? For stopping the execution after the first complete animation.
Thanks

Got TypeError: Cannot read property 'ClampToEdgeWrapping' of undefined

Hi everyone! I am in progress with a Vue.js project and facing some issue when I tried to use blotter.js for my resume page.
Here is my script block below.
I tried to import blotter.min.js and channelSplitMaterial.min.js into my file.
According to the document says, there is no need to import three.js or install modules but I got a TypeError: Cannot read property 'ClampToEdgeWrapping' of undefined Error.
After some research I thought the ClampToEdgeWrapping seems to be a module of three.js.
Am I misunderstanding something?
Really sorry that I know that maybe this is not a blotter.js issue but a Vue.js issue but there are nothing can reference about blotter with vuejs even within Vue's Chinese forum.

<script>
import '../../build/blotter.min.js'
import '../../build/channelSplitMaterial.min.js'
export default {  
  
  data() {
    return {
      name: 'Landing',
      bgImg: '.../src/assets/bgImg/[email protected]',
      url: '.../src/assets/avatar.png'
    }
  },
  mounted() {
    this.blob()
  },
  methods: {
    blob() {
      const text = new Blotter.Text('very cool', {
        family: "'EB Garamond', serif",
        size: 100,
        paddingLeft: 0,
        paddingRight: 0
      });

      let material = new Blotter.ChannelSplitMaterial();

      // Set material opts
      material.uniforms.uOffset.value = 0.08;
      material.uniforms.uRotation.value = 45;
      material.uniforms.uApplyBlur.value = 1;
      material.uniforms.uAnimateNoise.value = 1;


      let blotter = new Blotter(material, {
        texts: text
      });

      let scope = blotter.forText(text);
      let elem = document.getElementById('blotz');
      scope.appendTo(elem);
    }
  }
}
</script>
TypeError: Cannot read property 'ClampToEdgeWrapping' of undefined
    at Object.eval (blotter.min.js?b6c6:25755)
    at Object.require.1.three (blotter.min.js?b6c6:25776)
    at o (blotter.min.js?b6c6:25750)
    at r (blotter.min.js?b6c6:25750)
    at Object.eval (blotter.min.js?b6c6:25750)
    at eval (blotter.min.js:29989)
    at Object../src/build/blotter.min.js (0.js:214)
    at __webpack_require__ (app.js:767)
    at fn (app.js:130)
    at eval (cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/LandingPage/index.vue?vue&type=script&lang=js&:2)

Multiline

Hi Bradley,

It is possible include multiline text?

For example, for a text with 5 lines, i need to generate a 5 canvas elements and the optimization and performance is very bad.
If it were possible to include multiline text, the performance would be much better by having a single canvas.
Also, to simulate the fluency as a group I had to generate each text by playing with the paddings so that they all move as a group and not as independent texts.

Thank you very much!
Awesome plugin!

5-20 FPS on a retina display

Hi!
It's working very slow on my retina display. Could you give me any advice to improve the performance besides reducing the ratio?

Thanks!

Blotter.LiquidDistortMaterial is not a constructor

Hi - just copying the example verbatim from the "basics/example2" documentation and getting an error:

Blotter.LiquidDistortMaterial is not a constructor at var material = new Blotter.LiquidDistortMaterial();

Any idea what's going on? My html just includes a script with the current production version of blotter, and then another script tag to the code that instantiates blotter, plus a valid dom element to insert the text into.

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.