This is a plugin meant for Jekyll.
Example use:
Easily embed a YouTube video. Just drop this file in your _plugins directory.
{% youtube oHg5SJYRHA0 %}
| // Ported from Stefan Gustavson's java implementation | |
| // http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf | |
| // Read Stefan's excellent paper for details on how this code works. | |
| // | |
| // Sean McCullough banksean@gmail.com | |
| /** | |
| * You can pass in a random number generator object if you like. | |
| * It is assumed to have a random() method. | |
| */ |
| # Recursive backtracking algorithm for maze generation. Requires that | |
| # the entire maze be stored in memory, but is quite fast, easy to | |
| # learn and implement, and (with a few tweaks) gives fairly good mazes. | |
| # Can also be customized in a variety of ways. | |
| DIRS = (N, S, E, W = 1, 2, 4, 8) | |
| DX = { E => 1, W => -1, N => 0, S => 0 } | |
| DY = { E => 0, W => 0, N => -1, S => 1 } | |
| OPPOSITE = { E => W, W => E, N => S, S => N } |
This is a plugin meant for Jekyll.
Example use:
Easily embed a YouTube video. Just drop this file in your _plugins directory.
{% youtube oHg5SJYRHA0 %}
| #include "ofMain.h" | |
| #include "ofAppGlutWindow.h" | |
| class ofApp : public ofBaseApp { | |
| public: | |
| ofMesh mesh; | |
| ofEasyCam cam; | |
| void setup() { |
| class MyClass { | |
| /* | |
| usage: | |
| function x() { | |
| var c = new MyClass(); | |
| var x = c.func(10); | |
| } | |
| */ | |
| macro public function func(ethis: Expr, block: Expr): Expr { |
| //testApp.h | |
| #pragma once | |
| #include "ofMain.h" | |
| class testApp : public ofBaseApp{ | |
| public: | |
| void setup(); | |
| void update(); |
| // Given a Vec2 vector class... | |
| function hitPolygonAxis(points: Array<Vec2>, ret: Array<Float>) { | |
| for (i in 0...points.length) { | |
| var a = points[i]; | |
| var b = points[(i+1) % points.length]; | |
| var v = Vec2.make(b.x - a.x, b.y - a.y).normal(); | |
| // we should be able to only use half circunference. | |
| ret.push(v.angle()); | |
| } | |
| } |
| package; | |
| import flash.display.Graphics; | |
| import flash.display.Sprite; | |
| import flash.events.Event; | |
| import flash.events.KeyboardEvent; | |
| import flash.Lib; | |
| import flash.ui.Keyboard; | |
| import flash.Vector; |
| package ; | |
| #if CLIENT | |
| #else | |
| import entities.Flag; | |
| import entities.HealthPack; | |
| import entities.Spawn; | |
| import flixel.util.FlxPoint; | |
| #end |
Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative
float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);