Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 954 Bytes

readme.md

File metadata and controls

45 lines (33 loc) · 954 Bytes

Simple 2D Race Track Generator

Installation

composer require amberlampsio/racetrack-generator

Requirement

ImageMagick

Usage Examples

$track = (new Track())->drawTrack();
        
header("Content-Type: image/png");
echo $track->getImageBlob();

Additional Options

$track = (new Track())
          ->setBackgroundColor('black')
          ->setStrokeColor('white')
          ->setStrokeWidth(2)
          ->setStrokeOpacity(0.8)
          ->drawTrack(); //returns an Imagick Object
          

$track->setImageFormat("png");
$track->trimImage(0);
	
//square up an image
$track->rotateImage('black', 45);
$track->scaleImage(300, 300, true);
	
header("Content-Type: image/png");
echo $track->getImageBlob();

Credit

This is a port of a JavaScript Racetrack generator found on, http://static.opengameart.org/procgen/track.html https://opengameart.org/forumtopic/procedural-racetrack-generation-in-javascript