Git Product home page Git Product logo

ptg's Introduction

Procedural Texture Generator

The Procedural Texture Generator is a JavaScript tool for creating textures and patterns on HTML5 canvas. It lets you make all sorts of designs using code, like making clouds or funky geometric shapes. You can tweak colors, shapes, and other settings to get just the look you want. Then, you can easily draw your creations right onto a canvas on your webpage. It's perfect for making interactive web apps, digital art, or experimenting with cool visual effects! Learn more about procedural textures.

Usage

index.html

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<script type="text/javascript" src="ptg.js"></script>
</head>
<body>
	<canvas id="c" width="100" height="100"></canvas>
	<script type="text/javascript" src="main.js"></script>
</body>
</html>

main.js

const canvas = document.getElementById('c');
const tg = new PTG.ProceduralTextureGenerator(canvas);
tg.set([{
	program:'sinX',
	blendMode:'add',
	tint:[0,1,0],
	frequency:0.031,
	offset:0
},{
	program:'sinY',
	blendMode:'multiply',
	tint:[0,1,0],
	frequency:0.031,
	offset:0
},{
	program:'twirl',
	tint:[1,1,1],
	radius:100,
	strength:100,
	position:[128,128]
}]);

See it in the demo site.

Parameters

Programs

  • tint
  • sinX
  • sinY
  • or
  • xor
  • checkerBoard
  • rectangle
  • circle
  • noise
  • fractalNoise
  • cellularNoise
  • voronoiNoise
  • cellularFractal
  • voronoiFractal
  • transform
  • sineDistort
  • twirl

Blend Modes

  • add
  • subtract
  • multiply
  • divide
  • and
  • or
  • xor
  • screen
  • difference
  • darken
  • lighten
  • overlay
  • exclusion

ptg's People

Contributors

andraswebcode avatar

Watchers

 avatar

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.