Giter Site home page Giter Site logo

xslt-perlin2d's Introduction

XSLT-Perlin2D

A 2D perlin noise SVG generator using XSLT 2.0 and self loathing.

Its ugly, slow, and I'm sorry for bringing it into existence.

Build

  • This was actually a huge pain to figure out which XSLT processor to use (xalan, saxon, xsltproc, etc)
  • I ended up doing something gross. I used Apache Ant and Saxon9.
  • To build with Saxon9 (XSLT 2.0) use ant Recommended
  • Can also be built with XALAN (XSLT 1.0) use groovy build-xalan.groovy but its runs terribly at greater than 128x128 size

Generated SVG

perlin-screenshot

Input XML (perlin-svg.xml)

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="perlin.xslt" type="text/xsl"?>
<perlin-noise>
  <settings>
    <sizeX>256</sizeX>
    <sizeY>256</sizeY>
    <seed>1234</seed>
    <frequency>6</frequency>
    <octaves>4</octaves>
  </settings>
</perlin-noise>

Generated Perlin noise XML example-perlin.xml

Sample of perlin noise data that is generated before transforming to SVG.

Output SVG perlin.svg

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256">
  <rect x="1" y="1" width="1" height="1" fill="rgb(66,66,66)"/>
  <rect x="2" y="1" width="1" height="1" fill="rgb(61,61,61)"/>
  <rect x="3" y="1" width="1" height="1" fill="rgb(180,180,180)"/>
  <rect x="4" y="1" width="1" height="1" fill="rgb(160,160,160)"/>
  <!-- ... -->
</svg>

XSLT Descriptions

File Name Description
hash.xslt Pre-computed hashes for generating perlin noise
map.xslt Create map data structure of pixels
noise.xslt Generate 2D Perlin noise
perlin-svg.xslt Driver
svg-utils.xslt Utils for SVG generation and color value conversion
utils.xslt General utils

Sources

xslt-perlin2d's People

Stargazers

 avatar

Watchers

 avatar  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.