Skip to content

Instantly share code, notes, and snippets.

Avatar

J.D. Zamfirescu zamfi

View GitHub Profile
View champagne.js
var circles = [];
function setup() {
createCanvas(400, 400);
var count = 0;
while (count < 20) {
circles.push({
x: random(width),
y: height,
vx: 0,
View trump.pde
int trumpFactor;
void setup() {
size(500, 500);
}
void draw() {
background(255);
translate(width/2, height/2);
View circles-arrays.js
var x = [];
var y = [];
var xSpeed = [];
var ySpeed = [];
var colors = [];
function setup() {
createCanvas(400, 400);
for (var index = 0; index < 100; index = index + 1) {
View circles-objects.js
var circles = [];
function setup() {
createCanvas(400, 400);
for (var index = 0; index < 100; index = index + 1) {
circles[index] = {
x: width / 2,
y: height / 2,
xSpeed: random(-5, 5),
View pong.js
var puck = {
x: 200,
y: 200,
xSpeed: 3,
ySpeed: -1,
r: 15
};
var edgeOffset = 20;
var player1 = {
View move-trailer-generator.html
<html>
<head>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="tracery.js"></script>
<title>Text Generator</title>
</head>
<body>
<button onclick="addNewTrace()">One more!</button>
<div id="main"></div>
View lights.ino
class Blinker {
public:
Blinker(int pin, float periodSeconds, float onSeconds = 0.5, float delayUntilStart = 0.0) {
this->pin = pin;
period = periodSeconds * 1000;
onTime = onSeconds * 1000;
offset = delayUntilStart * 1000;
nextOn = millis() + offset;
pinMode(pin, OUTPUT);
}
View ngrams.txt
-ENDMESSAGE- because it :: 0.8181818181818182 (9:2)
-ENDMESSAGE- mile :: 0.18181818181818182 (2:9)
-ENDMESSAGE- thank you :: 0.7692307692307693 (10:3)
able to :: 0.7692307692307693 (10:3)
all agree :: 0.14285714285714285 (2:12)
all agree -ENDMESSAGE- :: 0.09090909090909091 (1:10)
average :: 0.21739130434782608 (5:18)
be able :: 0.8181818181818182 (9:2)
be able to :: 0.8181818181818182 (9:2)
be around :: 0.23076923076923078 (3:10)
View pose-example.js
var poses = [
{
"nose": {
"x": 333.79916958873963,
"y": 281.8711811385424,
"confidence": 0.9843198657035828
},
"leftEye": {
"x": 385.9717814127604,
"y": 245.32875046163042,
View hues-array.js
var hues = [14,134,13,65,134,243,95,68,345];
colorMode(HSB);
noStroke();
for (var i = 0; i < hues.length; i += 1) {
fill(hues[i], 100, 100);
ellipse(20+i * 30, height/2, 15);
}
You can’t perform that action at this time.